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!

Create a new value to submit from form inputs

Status
Not open for further replies.

gruvn

Programmer
Oct 15, 2004
24
CA
Hi,
I have form where users can enter information such as their zipcode to get some information back about it. However, the page that my form submits to only accepts data in a particular format, such as "ZIPCODE.USA.ZIP = 96822", where 96822 would be the value entered by the user.

I guess what I need to do when the user hits submit is take their input information, format it appropriately, and then submit it to the receiving page.

I'm thinking it will be in this general format...

<script type="text/javascript>
<!--
function submit(){
do stuff to append (concatenate?) together the various elements of the form into a single query readable by the 2nd page....
-->
</script>

<form name="form1" method="post" action="Query.html">
<input name="queryValue" size="70" type="text" id="queryValue">
<input name="stringStart" size="70" type="hidden" id="queryString" value="ZIPCODE.USA.ZIP =">
<input type="button" onclick="javascript: submit();" >
</form>

As you can see by my question, I'm not really good with javascript...

Thanks for anything!

g
 
Try something like this:

Code:
<script type="text/javascript>
<!--
function formSubmit(frm) {
	frm.elements['finalValue'].value = 'ZIPCODE.USA.ZIP = ' + frm.elements['queryValue'].value;
}
//-->
</script>

<form name="form1" method="post" action="Query.html" onsubmit="formSubmit(this);">
	<input name="queryValue" size="70" type="text">
	<input name="finalValue" type="hidden" value="">
	<input type="submit" value="Go!">
</form>

Hope this helps,
Dan


[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top