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 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++;
>                 }
>         });
>         if(numSelected == 0) {
>                 $("#attribAlert").text("at least one attribute must be filled 
> in");
>                 return false;
>         }
>
> cheerz!
>
> On Feb 19, 8:18 am, netcomp <ra...@netcompulsion.com> wrote:
>
> > 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;
> > > 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
> > > yourform.
>
> > > (i'm also a starter)
>
> > > 2009/2/18 netcomp <ra...@netcompulsion.com>
>
> > > > Hello, I'm a bit new to jQuery.  I have adynamicformwhich could
> > > > contain any number of input boxes (from 1 to 13) named attrib1 thru
> > > > attrib13.  I need to ensure at least one of the input boxes gets
> > > > filled in - there again it can be any of the generated boxes.
>
> > > > Don't suppose someone canhelpget me started?
>
> > > > TIA

Reply via email to