Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
0
How to get Data from IgbForm Submit using GetFormData Method
posted

Hi, I am very new to Infragistics, as suggested by my employer who is already using Infragistics in WebForms and willing to select Infragistics for Blazor Development. 

I as a developer trying your different components that fits our need. I started with IgbForm and so far it is good, but I am not sure how to get Form Data on Submit. 

I was unable to find any information on your Docs.

<IgbForm id="form" Submit="FormSubmit">
    <div>Subscribe</div>
    <IgbInput Required="true" name="name" DisplayType=InputType.Text Label="Your Name"></IgbInput>
    <IgbInput Required="true" name="email" DisplayType=InputType.Email Label="Your E-mail"></IgbInput>
    <IgbCheckbox name="agreement">I accept the license agreement</IgbCheckbox>
    <br />
    <IgbButton DisplayType="ButtonBaseType.Reset">Reset</IgbButton>
    <IgbButton DisplayType="ButtonBaseType.Submit">Submit</IgbButton>
</IgbForm>

and in C# Code I do this 

private async Task FormSubmit()
{
    //How to get FormData here ? How do I use GetFormData method here ?
}

Parents
No Data
Reply
  • 29085
    Suggested Answer
    Offline posted

    The Submit event works in 23.1.73 onward

    I noticed the event args were missing from your code. 

    Please try this, I also attached a working sample demonstrating how to index into the fields of the form to get their values. Let me know if you have any questions. 
     

    <div class="container vertical">
    <IgbForm id="form">
    <IgbForm @ref=form id="form" Submit="OnSubmit">
    <div>Subscribe</div>
    <IgbInput Required="true" DisplayType=InputType.Text Label="Your Name"></IgbInput>
    <IgbInput Required="true" DisplayType=InputType.Email Label="Your E-mail"></IgbInput>
    @ -15,6 +15,9 @@
    </div>

    @code {

        public IgbForm form { get; set; }
        public async Task OnSubmit(IgbFormDataEventArgs e)
        {
            Console.WriteLine(e.Detail.Values[0].ToString());
        }

Children
No Data