I want to use the JQuery Validation Engine plugin to look over dynamically added hidden input fields.
At least one of this fields has to be there, when the form is submitted.
It tried to achieve this with the groupRequired Validator
http://posabsolute.github.com/jQuery-Validation-Engine/#validators/grouprequired
<link rel="stylesheet" href="css/validationEngine.jquery.css" type="text/css"/>
<script>
$(document).ready(function(){
$("#tagform").validationEngine();
});
</script>
<form id="tagform">
<input type="hidden" name="tags" id="tags-input" />
<input type="hidden" name="inc" value="locate">
<input type="hidden" class="validate[groupRequired[tagitem]]" name="validation">
<br><br>
<input type="submit" value="Save Tags">
</form>
Added Fields look like:
var formhtml ='<input type="hidden" name="tags[]" class="validate[groupRequired[tagitem]]" id="id'+itemid+'" parenttag="'+parent+'" value="'+itemid+'">';
$("#tagform").append(formhtml);
At the moment it simply doesn't check for the hidden fields.
Any idea how to fix this or another approach ?
Workaround
Use a simple javaskript onSubmit Function to check occurens of tags
function checkForm(form)
{
var count = $('input[name="tags[]"]').length;
if(count == 0 ) {
alert("Select at least one tag");
return false;
}
alert ("Count " + count)
return true;
}
Still would love to use Jquery Validation Engine