Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

onSelect load page

Status
Not open for further replies.

mwpclark

Programmer
Mar 14, 2005
59
US
Hello

I have a form that is displayed within an iframe, named "contribute". The form is a php page, "form.php".

The first field in the form is a drop-down select field. I want to use onSelect (I *think*) to reload the php page within the iframe, passing the value of the selected option to php.

That is, when selected:

<select name="identity" onSelect statement???>
<option value="1">1</option>

should output the following:

"/form.php?identity=1" target="contribute" (or "_self")

Do any quick javascript examples come to mind?

Thanks a bunch
Mike
 
Sorry maybe that should be onfocus or onchange.
 
If your form is set up with the 'get' method, simply submit the form:

Code:
<select name="identity" onchange="this.form.submit();">

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Tech Snippets & Info:
 
alternatively you can use the window.location method.


Code:
<select name="identity" onChange="window.location='nameofpage.php?myvalue=' + this.value;">
<option value="1">1</option>


----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top