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

Passing variable to URL on Submit

Status
Not open for further replies.

dadms

Technical User
Mar 8, 2003
67
US
Help!! I have a form where people will enter their ticket number. This ticket number will be attached to the end of the URL and when submit(or enter) is selected it will retrieve the URL. The code does not work please help.

<html>

<head>
<title>NT TICKET SEARCH</title>
</head>

<body>

<SCRIPT LANGUAGE=&quot;JavaScript&quot;>
</SCRIPT>

<form name=&quot;ntlkup&quot; onSubmit=&quot;id_number=window.document.ntlkup.ticket.value;&quot;>

<input type=&quot;text&quot; name=&quot;ticket&quot; size=&quot;20&quot;><input type=&quot;submit&quot; value=&quot;Submit&quot; >
</form>
</body>
</html>
 
<form name=&quot;ntlkup&quot; onSubmit=&quot;javascript: window.location.href ='id_number='+window.document.ntlkup.ticket.value&quot;>

this would change the window location at the same time as sending the form - wouldn't you be better off having an input called id_number and using the get method on the form.
 
You'd normally do something like ...
Code:
<html>
<head>
<title>NT TICKET SEARCH</title>
</head>
<body>
 
<form action=&quot;[URL unfurl="true"]https://app27.nt.com/eSupportJSP/CaseShowContent.jsp&quot;[/URL] name=&quot;ntlkup&quot;>
<input type=&quot;text&quot; name=&quot;ticket&quot; size=&quot;20&quot;>
<input type=&quot;submit&quot;  value=&quot;Submit&quot; > 
</form>
</body>
</html>
Then your jsp can get the value of the param using request.getParameter(&quot;ticket&quot;); and display accordingly.

Make any sense?

Greg.
 
I do not understand the last message but here is what I am trying to accomplish.

If I log into this nt site and i query my ticket 03000-4000 in there portal the URL is:

id_number=030000-40000

The 030000-40000 is the variable and could be any number. Since all but the variable is constant I would like a form that queries the ticket number I put in the text box.

Thanks
 
then all you need is this.

<form action=&quot; method=&quot;get&quot;>
<input type=&quot;text&quot; name=&quot;id_number&quot;>
<input type=&quot;submit&quot;>
</form>

using the get method in the form tag means that the data is sent as a url parameter.

hope this helps

simon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top