Jquery validate send prevention sent in message

I am using jquery validation to validate an existing phone number in my database. I use jquery to check for deleted attributes.

remote: { url: "ajax-checkmobile.php", type: "post", data: { cust_id: function() { return $("#cust_id").val(); } } } 

However, this prevents the submission of the submit value when submitting the form via POST.

 <input name="Submitcustdata" type="submit" class="chromeButton" id="Submitcustdata" value="Edit Customer" /></td> 

After removing the above value, the code view is passed correctly. Any idea that might prevent the transfer of value

+4
source share
2 answers

I developed the following code that I use in the context of submitting forms using AJAX. This is not exactly your case, but the same code will make your value <input type="submit"> :

 function submit_click() { var $input = $(this); var name = $input.attr('name'); if (typeof name == 'undefined') return; var value = $input.attr('value'); var $form = $input.closest('form'); var $hidden = $('<input type="hidden" />').attr('name', name).attr('value', value); $form.find('input[type=hidden][name="' + name + '"]').remove(); $form.append($hidden); }; $(document).on('click', 'form.ajax input[type=submit]', submit_click); 

I use class="ajax" in the form element to activate this code. You can change according to your needs.

What is he doing? It creates a hidden form input with the same name and value as the clicked input input. So, when the message occurs programmatically later, the value is correctly represented.

And, you asked what could be preventing value from being passed ... the validation plugin latches the form submission and performs its actions. After verification, this initiates the submission of the form. When this happens, it is not the element of the <input> element that triggers the submission of the form anymore. This is the JavaScript plugin code. Thus, the event " <input> " is lost. That is why it is not represented. (Does it make sense? If this explanation is poorly written, let me know.)

+1
source

validate stops sending a message from happening to check. that is, by design.

therefore, if it is not sent, then his opinion that the field is not valid, I guess.

0
source

All Articles