View Full Version : Changing the default of a dropdown list depending on the url you are coming from
09-02-2011, 04:50 AM
I have a form that I am using for several different pages as they are exactly the same... however at the top you must make a choice from the drop down box that then shows the appropriate fields to fill in.
Can I make the drop down default to a certain option depending on which page they are coming from?
09-02-2011, 06:07 AM
So if you aren't using PHP/ASP/JSP/etc., then the best you can do is "pass along" the page you are coming from.
Several ways to do that. Say the page with the <form> is "myform.html". Okay, so just call it from the various pages via "myform.html?from=contact" or "myform.html?from=orderform" or whatever.
And then you can look for that "from=" in the JS code and do the appropriate thing.
Another way would be to set a COOKIE in each page you come from and then look for the cookie in "myform.html".
Before I go further, though, *can* you use PHP/ASP/JSP for this page?
09-02-2011, 06:22 AM
Lets try the cookie method...
There is actually two places in this site I am doing this...
I figured out one because I believe that is the jsp you were refering to above.
I simply put the url to the form then "?forminput=4". This works because the page is .jsp. (this links to someone elses site)
09-02-2011, 07:01 AM
Ummm...cookies only work if all the pages are on the *SAME SITE*.
If you want to refer to this page from other sites, then I suggest you use the "?from=xxxx" method, instead. Or learn to use PHP?
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.