- This topic has 2 replies, 2 voices, and was last updated 2 years, 10 months ago by .
-
Topic
-
Hi, Anh
Thanks for helping me in Defining custom validation methods topic. I have one more question, I want to put the error message after group of inputs and I tried to do that with following codejQuery.validator.addMethod('checkinputsportrow', function(element, value, param ){ filledinputs = jQuery('.grpsports input:text:filled').size(); allinputs = jQuery('.grpsports input:text').size(); if ( filledinputs == allinputs && filledinputs <= 0 ){ return false; } else if ( filledinputs != allinputs && filledinputs != 0 ) { return false; } return true; }, "Please Fill Complete information for Achievements in Sports" );
I have defined the fields under the group field having class
grpsports
Above validation is working but error placement (below ) does not, also works for clone fields but does not clear errors when it is correct and new set of cloned fields are there (workaround ?)jQuery("form#post").validate({ errorPlacement: function(error, element) { if (element.closest('.grpsports')) error.insertAfter(".grpsports input:text:last"); }, });
the above method needs a specific form id where as in backend its “post” and in front end its “rwmb-form” how can I make it generic
also I am in confusion that how to define a group in validation plugin
can you please help me
Thanks in advance
- You must be logged in to reply to this topic.