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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automated submit w.out onload 1

Status
Not open for further replies.

walta

Programmer
Dec 28, 2001
9
DE
Hi Folks,
I´d like to submit a form automatically, without using the onload() function, it should be done within the code.
There´s a form, which will be shown,if an option is true.
The form will show a select with onchange.
but if theres no option, the form should be automaticly submitted
sample:
Code:
<form action=&quot;test_dr.php3&quot; method=&quot;post&quot;>
<input type=&quot;hidden&quot; name=&quot;scar&quot; value=&quot;'.$scar.'&quot;>
// ... some more &quot;hiddens&quot;
if(something)
{
<select onchange=&quot;form.action='test_dr.php3'; form.submit();&quot; name=&quot;cmodell&quot;>
<option>....
</select>
// works fine
}
else
{
<input type=&quot;hidden&quot; name=&quot;cmodell&quot; value=&quot;$scar&quot;>
<script type=&quot;text/javascript&quot;> form.action='test_dr.php3'; form.submit();
</script>
}
</form>
It doesn´t work. I couldn´t use <meta http-equiv=&quot;refresh&quot; content=&quot;0; URL=URI&quot;> cause it´s in the middle of code, and some browsers make errors. Even I have to put several &quot;hidden&quot; vars.
BTW This is inside php-code so the vars start with $.
Any Ideas?
TIA Oliver
 
PROBLEM SOLVED
Thanx chebbi,
just added &quot;name&quot; and it worked!
code snippet:
<form name=&quot;model&quot; action=&quot;test_dr.php3&quot; method=&quot;post&quot;>
if(..)
{ // you have to select something
<select onchange=&quot;form.action='test_dr.php3'; form.submit();&quot; name=&quot;cmodell&quot;>
<option>..</option>
}
else
{ // if nothing´s to select
<script type=&quot;text/javascript&quot;> form.action='test_dr.php3'; form.submit(model);</script>
}
</form>
thanks again ! Oliver
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top