Link to home
Start Free TrialLog in
Avatar of Bobo--just_East_of_Madison
Bobo--just_East_of_MadisonFlag for United States of America

asked on

Have a menu option selected on page load, possibly by passing a value through the URL

Hello:

I'd like to pass a value to a web form so that on page load, the menu selection will be made to the predefined value.

For example:

Form on http://www.echoecho.com/htmlforms11.htm below "Settings" defaults to "Butter."
In this example, I'd like to have the menu option be "Milk."

A few caveats:

--I have access to change the code for the page the form is iframed in, but not the form itself.
--I cannot use any third-party software
--I cannot use bookmarklets
--A URL solution is preferred (pass the value in the URL, if possible)


Thanks,

Bobo
Avatar of Derek Jensen
Derek Jensen
Flag of United States of America image

Can you use PHP/ASP? Or are you limited to HTML only? HTML doesn't have the capacity to capture form-submitted values on its own; if you are using PHP, you'd have to capture the $_GET['select_name'] (which is the value of the selected option for the select tag named "select_name", NOT necessarily the text displayed in that dropdown), and then as you're building the select, test each value against $_GET['select_id_name'] and, if equal, add 'selected="selected"' to the current option's tag. This will make the same option selected before the form is submitted to still be selected after. :)
That is, of course, assuming you're submitting to the same page. ;-)
Avatar of Bobo--just_East_of_Madison

ASKER

Can't use PHP, but I'm not limited to HTML. I can use javascript (json) and jconsole. I'm on Apache Tomcat and I don't have access to the server, so my assumption is that I wouldn't be able to use PHP without tweaking something with the server. I've never seen PHP run on Tomcat without some server-side tweaking. I have used PHP on Apache.
ok, well...then you should be good. :) You'll have to do some server-side processing, as JS doesn't have the ability to capture POST & GET params...afaik...
@bigdogdman

Besides PHP, do  you know of any other client-side scripting that can be used? And that doesn't require changes at the server level?

Anyone else?
ASKER CERTIFIED SOLUTION
Avatar of Derek Jensen
Derek Jensen
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial