Click here to Skip to main content
15,884,237 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
file1.cshtml

HTML
<pre><form id="cust" name="Customer" method="post">
    <div>
        <p>@Html.TextBoxFor(m => m.Email, new { required = "required", placeholder = "Email", id = "cust-email", maxlength = 255 })</p>
        <label id="lbl-cust-email-error" class="error error-label-style">@Html.ValidationMessageFor(m => m.Email)</label>
        <small class="field-tip">Use your real email address. We don't spam.</small>
    </div>
<div>
            <input id="submit-cust" type="submit" value="Join"/>
        </div></form>



file2.cshtml

HTML
<pre><div id="Customeridentity" hidden="hidden" class="registration_form_element">
                                    @Html.Partial("_file1")
                                </div>
 <script>
$("body").on("click", "#submit-cust", function () {
var formValidator = $("form#cust").data('kendoValidator');
if(formValidator.validate()){
$.ajax({
                            type: 'POST',
                            url: '@Url.Action("IsCustomerModelStateValid", "Account")',
                            data: form.serialize(),
                            success: function (data) {
                                isClickedJoinFreightRover = false;
                                if (data.IsValid) {
                                    $(".field-validation-error").hide();
                                    var registerUrl = '@Url.Action("RegisterCustomer", "Account")',
                                }
                                else {
                                    $('#Customeridentity').html(data);
}
}
});
}
});
</script>


first time click with wrong data kendo validator is working.
After $('#Customeridentity').html(data) append and next again submit the kendo validator is undefined error show.The data is coming same form and with error value.

What I have tried:

I have tried almost all possibility
Posted
Comments
Bryian Tan 7-Sep-17 7:33am    
What are you trying to accomplish with this line $('#Customeridentity').html(data); ?
Sathiya moorthi 7-Sep-17 8:59am    
When i enter the wrong email,This details will append in the data("
<div class="marg_pad"></div>
<form id="cust" name="Customer" method="post" class="">
    <div class="col-lg-12 col-md-12 no-padding">
        <p><input class="input-validation-error" data-val="true" data-val-email="The Email field is not a valid e-mail address." data-val-required="The Email field is required." id="driver-email" maxlength="255" name="Email" placeholder="Email" required="required" type="text" value="fgse" /></p>
        <label id="lbl-driver-email-error" class="error error-label-style"><span class="field-validation-error" data-valmsg-for="Email" data-valmsg-replace="true">The Email field is not a valid e-mail address.</span></label>
        <small class="field-tip">Use your real email address. We don't spam.</small>
    </div>
 <input id="submit-cust" type="submit" value="Join"/>
        </div></form>
")
Bryian Tan 7-Sep-17 10:18am    
try append it to a different element
div id="Customeridentity" hidden="hidden" class="registration_form_element">
                                    @Html.Partial("_file1")
<div id="appendToHere"></div>
                                </div>

$('#appendToHere').html(data);
Sathiya moorthi 7-Sep-17 11:25am    
I try this but its come twice time data will append. first data is original form details and second data is with error
Graeme_Grant 16-Sep-17 9:48am    
Try asking the question here: Kendo UI Forums - Telerik Community[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900