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

Submitting a value

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I have several submit buttons within my page.

<input type=button value=Access onClick=access()>

e.g.
function access(){
document.forms[0].action = './main.html';
document.forms[0].submit();
}

Is it possible to submit a value (access) from this function?? so that it can be read by the next page.
 
Why not take your buttons and pass a value to your function. Then within that function based on which button was pushed set a hidden variable that would be available to the next page?

<input type=&quot;hidden&quot; value=&quot;&quot; name=&quot;buttonPressed&quot;>

<input type=button value=Access onClick=access(1)>
<input type=button value=Access onClick=access(2)>

function access(button)
{
if(button == 1)
{
document.forms[0].buttonPressed.value = &quot;pressed buton one&quot;;
}else{
document.forms[0].buttonPressed.value = &quot;pressed buton two&quot;;
}
document.forms[0].action = './main.html';
document.forms[0].submit();
}

Just a thought . .

Rachel
 
Put a hidden field in your form and set the value of the hidden field from within your function:
Code:
document.forms[0].param.value = &quot;access&quot;;
....
<input type=&quot;hidden&quot; name=&quot;param&quot; value=&quot;&quot;>
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top