On 7月13日, 上午3時44分, J rn Zaefferer <[EMAIL PROTECTED]> wrote: > howard chen wrote: > > > abt this plugin: > >http://bassistance.de/jquery-plugins/jquery-plugin-validation/ > > > several problems: > > > 1. Is it possible to dynamic add INPUT into the current list of checking? > > You can use validator's refresh method to check for additional input > elements. That works best when combined with metadata. Otherwise you > have to extend the rules-object you passed into the plugin method.
Hello, I am not using metadata, can you provide some sample how to refresh the inputs? (I use jQuery to clone an input text field, and insert into html by assigning a different ID but same name, i.e. "email[]") > > > 2. Is it possible to user `id` instead of `name`? > > You could overwrite jQuery.validator.prototype.idOrName to always return > the ID of the given element.> 3. Is it possible to check for something like > name="email[]" ? > seems the codes has some of hardcoded element.name...modifying the idOrName is not enough, anyway, i get this work by replace all .name to .id > Sure. Just put the name into quotes when specifying validation rules, > eg. "email[]": { required: true, email: true } this trick only work with the first input has the name "email[]", i.e. the following codes didn't work with the second and third inputs, e.g. <html><head> <script src="jquery.js"></script> <script src="jquery.validate.js"></script> </head><body> <script> $(document).ready(function() { $("#form1").validate({ event: "submit", rules: { "email[]" : { email: true } }, messages: { } }); }); </script> <form name="form1" id="form1"> <input type="text" name="email[]" value="" /> <input type="text" name="email[]" value="" /> <input type="text" name="email[]" value="" /> <input type="submit" name="submit" value="submit!" /> </form> </body></html> Thank you so much or your help! Howa