Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Telerik MVC Extensions (superseded) > TabStrip > Client Validation in LoadFromContent

Answered Client Validation in LoadFromContent

Feed from this thread
  • Ivan avatar

    Posted on Feb 8, 2012 (permalink)

    Is it possible to validate on client, input in form which is loaded via ajax call.

    Reply

  • Alexander Valchev Alexander Valchev admin's avatar

    Posted on Feb 8, 2012 (permalink)

    Hello Ivan,

     I suggest using jquery.validator.unobtrusive.parse method to achieve your goal. There is a sample project for common validation problems in our code library.

    I hope this information helps. Please let me know if I can assist you any further.

    Regards,
    Alexander Valchev
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>

    Reply

  • Ivan avatar

    Posted on Feb 9, 2012 (permalink)

    I tried with jquery.validator.unobtrusive.parse butt with no results.

    Try to put <form> tag around tabstrip, and you will see, or just check attached solution.

    Reply

  • Alexander Valchev Alexander Valchev admin's avatar

    Posted on Feb 9, 2012 (permalink)

    Hi Ivan,

     <form> tag should not be wrapping the tabstrip, but the form's elements themselves.

    @model User
     
        @*@Html.EditorForModel()*@
        @using (Html.BeginForm())
        {
                @Html.TextBoxFor(model => model.UserName, new { style = "width:200px;" })
                @Html.ValidationMessageFor(model => model.UserName)
                <br />
                @Html.TextBoxFor(model => model.Email, new { style = "width:200px;" })
                @Html.ValidationMessageFor(model => model.Email)
                <input type="submit" value="Save" />
        }

    I edited your project. Please check the attachment.

    Greetings,
    Alexander Valchev
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
    Attached files

    Reply

  • Ivan avatar

    Posted on Feb 9, 2012 (permalink)

    Butt I want exactly tabstrip to be placed inside of  <form> tag .
    Because I have several tabs and all of them should reside in one <form> tag for later submission to server.

    Reply

  • Answer Alexander Valchev Alexander Valchev admin's avatar

    Posted on Feb 13, 2012 (permalink)

    Hello Ivan,

    It is not possible to validate the form items loaded via Ajax in your case, because:
    • If there is no form in the partial view so validation attributes of input fields will not be rendered.
    • If there is a form, it will be possible to validate and submit the data only within the current tab. However that will not work in Chrome, because the inner form will not be added to the DOM tree.
    In addition when you use LoadContentFrom method, input fields will not be added before their tab is selected. In other words, fields that are not loaded will not be validated or submitted.

    I suggest you to load form fields on the server using the Content method. For example:
    .Items(items =>
    {
        items.Add().Text("Insert in Ajax Loaded Tab")
        .Content(Html.Action("InsertUser").ToHtmlString());
    })

    This way all the problems above will be avoided.

     Greetings,
    Alexander Valchev
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Telerik MVC Extensions (superseded) > TabStrip > Client Validation in LoadFromContent
Related resources for "Client Validation in LoadFromContent"

ASP.NET MVC TabStrip Features  |  Documentation  |  Demos  |  Telerik TV ]