[jQuery] Re: Help validating dynamic form elements

2009-02-25 Thread netcomp
just a followup, figured it out finally. its basically like the first example, testing for a value, then testing for zero var numSelected = 0; jQuery.each($(#frmRequests).find('.attribs'),function() { if($(this).val() != ) { numSelected++;

[jQuery] Re: Help validating dynamic form elements

2009-02-25 Thread sliver
You could also do something like: if ($('#frmRequests :text.attrib').filter(function() {return $ (this).val().length;}).size() == 0) { $(#attribAlert).text(at least one attribute must be filled in); return false; } On Feb 25, 6:12 pm, netcomp ra...@netcompulsion.com wrote: just a

[jQuery] Re: Help validating dynamic form elements

2009-02-19 Thread netcomp
thanx, that didn't work (at least the different variations I tried). I'l keep plugging away at things, it'll come to me sooner or later On Feb 18, 1:39 am, 刘明 charles.li...@gmail.com wrote: i suppose the 13 boxes' IDs are generated in order,so go through all the boxes by id: var pass=0;

[jQuery] Re: Help validating dynamic form elements

2009-02-18 Thread 刘明
i suppose the 13 boxes' IDs are generated in order,so go through all the boxes by id: var pass=0; for(var i=1;i=13;i++){ if($(#mybox+i).val() != ') pass+=1; } if(pass=0) return false; and then, put your code in a function and bind it to the submit event of your form. (i'm also a starter)