Hey Mark,

Sorry, I've been in the basement trying to finish up a release this week. I
hope you got that figured out, if not here are my quick thoughts. (Also,
sorry for the $j usage in the original, I use jQuery in safe mode at work.)

I would probably set a variable like:

if (containsStar >= 0) {
    $(".additionalInput").show();
    var requireAdditional = 'true';
  }

...and then you could append your validation with something like:

if (!requireAdditional) {
  // do your standard validation
} else {
  // do your extended validation
}


Hope that helps.

Wil Everts
[EMAIL PROTECTED]

On Tue, Apr 29, 2008 at 8:45 AM, Mark Clemons <[EMAIL PROTECTED]>
wrote:

> That's awesome! Just what I was looking for.
>
> In addition to that i also want to make the field required, so if they
> don't choose an asterix field, it's not required but if they do then i want
> them to fill in the additional field.
>
> Not sure how to merge your solution with the jquery Validation code. Any
> ideas?
>
>
> On Mon, Apr 28, 2008 at 10:44 PM, Wil Everts <[EMAIL PROTECTED]> wrote:
>
> > Mark,
> >
> > Here's some general sketching to help you along. There are likely
> > other/better ways to go about this, but this should work out for you.
> >
> > Where "selectVar" is the id of the select box:
> >
> > $j("#selectVar").change( function() {   // when something is selected
> > run this
> >
> >   var containsStar = $j("#selectVar").val().indexOf('*');
> >   /* if var mynewvar = 'bobx*' containsStar would = 4
> >      if var mynewvar = 'bobx' containsStar would = -1 */
> >
> >   if (containsStar >= 0) {
> >     $(".additionalInput").show();
> >   }
> >
> > });
> >
> >
> > Kindest,
> >
> > Wil Everts
> > [EMAIL PROTECTED]
> >
> >
> > On Mon, Apr 28, 2008 at 1:57 PM, RevolveGuy <[EMAIL PROTECTED]>
> > wrote:
> >
> > >
> > > I am using JQuery Validation and I'm trying to make a selection box
> > > that has several items, some of which have a * at the end, if you
> > > select one of those options then i want the next text field to become
> > > active. Anyone got any idea how to do this?
> > >
> >
>
>
> --
> Mark Clemons
> [EMAIL PROTECTED]

Reply via email to