error while post from using json

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
9 years ago
Hello All,

Errror.  

TypeError: a.validator.methods[b] is undefined
  

...var c={method:b,parameters:f[b]};try{if(d=a.validator.methods[b].call(this,k,h,c...


I am getting some issue when i want to post form using Json. Ex. Change password module.

i want to change passowrd using jquery to avoid page round trip for user.

My code is below.  

Please help me. what i am missing here...




@model ChangePasswordModel
@using Nop.Web.Models.Customer;
@{
    Layout = "";
}

@using (Html.BeginForm(null, null, FormMethod.Post, new {id="ChangePassword" }))
{
    @Html.AntiForgeryToken()
    <div>
        <div class="changepassworddiv">
            <div class="message-error">
                @Html.ValidationSummary(true)
            </div>
            @if (!String.IsNullOrEmpty(Model.Result))
            {
                <div class="result">
                    @Model.Result
                </div>
            }

            <div class="form-fieldsChangePassword">
                @*<div class="inputs">
                        @Html.LabelFor(model => model.OldPassword, new { }, ":")
                        @Html.EditorFor(model => model.OldPassword)
                        @Html.RequiredHint()
                        @Html.ValidationMessageFor(model => model.OldPassword)
                    </div>*@
                <div class="inputs">
                    @Html.LabelFor(model => model.NewPassword, new { }, ":")
                    @Html.RequiredHint()
                    @Html.EditorFor(model => model.NewPassword)
                    @Html.ValidationMessageFor(model => model.NewPassword)
                </div>
                <div class="inputs">
                    @Html.LabelFor(model => model.ConfirmNewPassword, new { }, ":")
                    @Html.RequiredHint()
                    @Html.EditorFor(model => model.ConfirmNewPassword)
                    @Html.ValidationMessageFor(model => model.ConfirmNewPassword)
                </div>
            </div>

            <div class="buttons">
                <input type="button" class="button-1 change-password-button" value="Change Password" id="btnChangePassword" />
                <script type="text/javascript">
                    $(document).ready(function () {
                        $('#btnChangePassword').click(function () {
                            $('#ChangePassword').validate();
                            $('#ChangePassword').submit();
                        })
                    });
                </script>
            </div>
        </div>
    </div>
}



Thanks in Advance...
9 years ago
Both  client side validation and server side validation are enabled by default for change password, round tip should not happen if browse javascript is enabled.
Anyway, your code should work, can you simple try $.validator in browser debugger tool to make sure that validate function is loaded.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.