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

Submit different values in a form

Status
Not open for further replies.

Atchett

Programmer
Dec 7, 2000
35
0
0
Hi,

Can anyone help me with this problem?

I am trying to submit a form. Firstly I am checking wether there is something in the text area, if not put in the message (which works fine) and then depending on which link was clicked it submits a different value for the next page to use in searching different databases.

<SCRIPT LANGUAGE=&quot;JavaScript&quot;>
<!--
var errMsg = &quot;Please enter your text here&quot;;
var newAction, formActionResult;

function doFunctionStuff(formAction)
{
if (document.form.query.value == &quot;&quot; || document.form.query.value == errMsg) {
document.form.query.value = errMsg;
bClearTextField = true;
}
else
{
newAction = formAction;
formActionResult = &quot;Page.asp?Test=&quot; + newAction
document.form.action = formActionResult
document.form.submit();
}
}
//-->
</SCRIPT>

The link I am using to submit:

<a href=&quot;javascript:doFunctionStuff('BitIWantInURL');&quot;>Some Link</a>

The form will submit to the Page.asp page and it will also submit what is in the text box but it won't submit the Test= part.

I realise it's probably something simple!!

Many thanks,

JB
 
>> formActionResult = &quot;Page.asp?Test=&quot; + newAction

don't change the action property. use a hidden form variable and set it's value then submit the form

Good luck
-pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top