JAVASCRIPT :conditional cgi script calling on form submit

January 9, 2009 on 3:29 pm | By | In bluefreesky.com | JAVASCRIPT :conditional cgi script calling on form submit
  • Is there a way using javascript (or otherwise) one could have a form such that a different script is called depending on some of the variables used. Just for example, if a person selects 'member' from a dropdown menu,, the form calls perl script 1 and if the person selects 'guest', the form calls php script 2.


  • Hello myq-ga Thank-you for your question. This can be achieved by using the following code. First of all you need the form on your page, it should be something like this: Notice, the name of the form and the onSubmit parameter. This calls the submitForm javascript function when the form is submitted. One parameter, the value of the dropdown box, is submitted to the javascript function when the form is submitted. The javascript to redirect you to another script would be done like this and should be placed in the section of your page: Basically, this says if the value submitted (choice - which comes from the dropdown box on the form) is equal to 1 then submit it to "member.html" otherwise it goes to "guest.html". Hopefully you should be able to edit this easily for your own use. If you have any questions on this subject please ask for clarification and I will do my best to respond swiftly.


  • Great! fast work! which browsers (main) and versions will this work on and which will it NOT work on?


  • Hi myq-ga This should work on any browser that has javascript enabled as nothing really browser-specific is being performed. It obviously will NOT work on any browser that has javascript disabled.







  • #If you have any other info about this subject , Please add it free.#
    Your name:
    E-mail:
    Telphone:

    Your comments:


    If you have any other info about JAVASCRIPT :conditional cgi script calling on form submit , Please add it free.