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

form submit with link+javascript doesn't work 1

Status
Not open for further replies.

grtfercho

Programmer
Apr 11, 2003
424
US
This is a really short version of my problem.
Any other code I stripped is just text and tables.

I'm going crazy trying to understand why the form won't submit using the link and Javascript.

<script>
function jump(txtvalue){

document.myform1.whereto.value=txtvalue;
alert(document.myform1.whereto.value);
document.myform1.submit();
}
</script>
<form name=&quot;myform1&quot; method=&quot;post&quot; action=&quot;&quot;>
<a href=&quot;javascript:jump('page_a');&quot;>jump Prev</a>&nbsp;
<a href=&quot;javascript:jump('page_c');&quot;>jump Next</a><br>
<input type=&quot;text&quot; name=&quot;comments&quot; value=&quot;enter comments&quot;>
<input type=&quot;hidden&quot; name=&quot;whereto&quot; value=&quot;&quot;>
<input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;Next&quot;>
</form>





Thanks for any help on finding the reason for the problem...

grtfercho çB^]\..
&quot;Imagination is more important than Knowledge&quot; A. Einstein
 
take the name=&quot;submit&quot; out of the submit tag
<input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;Next&quot;>

always when using the submit() function

_________________________________________________________
$str = &quot;sleep is good for you. sleep gives you the energy you need to function&quot;;
$Nstr = ereg_replace(&quot;sleep&quot;,&quot;coffee&quot;,$str); echo $Nstr;

onpnt2.gif
[/sub]
 
I think I understnad the reason now.
is there any other way to trigger the submit function?
somthing like
document.myform1.methods(&quot;submit&quot;) ???

or when naming an element in the form as Submit
that takes over any reference the form has to the actual submit function??

grtfercho çB^]\..
&quot;Imagination is more important than Knowledge&quot; A. Einstein
 
I think the best solution is to convert to a button type and run a seperate function performing the other needs for processing. I've always found this to be a more stable solution to multiple submit options


_________________________________________________________
$str = &quot;sleep is good for you. sleep gives you the energy you need to function&quot;;
$Nstr = ereg_replace(&quot;sleep&quot;,&quot;coffee&quot;,$str); echo $Nstr;

onpnt2.gif
[/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top