How make 1 javascript conditional on another

Discussion in 'Software' started by shedlord, Mar 13, 2007.

  1. shedlord

    shedlord Private E-2

    Hi, javascript rookie question for ya, hopefully an easy one

    I have a form with 2 select lists. One drop down allows the user to select a directory, the other lets them select a file. Once you press the form button an URL is built using these 2 selections using a bit of javascript. So far, so good.

    I also need to validate the form, so that the user selects something from the select lists, rather than leaving it on the default, which is just the list title. I use the popular Yaromat check form behaviour to do this. This part also works ok.

    However, I need to make the script which generates the URL conditional upon the validation being ok, so that if the user hasn't selected something from both lists the URL building and redirect doesn't happen.

    At the moment, the validation error message pops up but the user is forwarded to the incorrect URL regardless.

    If this makes little sense, check a quick demo I put online here...
    http://www.hplonline.co.uk/test.html

    So, how do I join 2 scripts together?

    thanks
     
  2. shedlord

    shedlord Private E-2

  3. shedlord

    shedlord Private E-2

  4. shedlord

    shedlord Private E-2

    Looks like I've drawn a blank there.
    Just have to assume this isn't going to work with an input=image and revert to buttons then.

    thanks anyway.
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds