Click to See Complete Forum and Search --> : multiple input text fields...
grommit168
07-16-2003, 08:34 AM
I need to enter a string of characters in 3 separate boxes and then need to combine the input into one string when the submit button is pressed. An example would be the http://www.aeroplan.ca where there are 3 input boxes with a max character for each box set to 3...
Any help would be appreciated...
Thanks!
Try something like this:
var = document.formname.input1.value+document.formname.input2.value+document.formname.input3.value;
grommit168
07-16-2003, 11:47 AM
would you be able to give more details about your solution...
Thanks!
Sure, here's a full script:
<html>
<head>
<script type="text/javascript">
function addValues() {
val = document.myform.input1.value+document.myform.input2.value+document.myform.input3.value;
alert (val);
}
</script>
</head>
<body>
<form name="myform">
1: <input type="text" name="input1"><br>
2: <input type="text" name="input2"><br>
3: <input type="text" name="input3"><br>
<input type="button" value="Concatenate" onclick="addValues()">
</form>
</body>
</html>
grommit168
07-16-2003, 02:27 PM
thanks!
i am having trouble trying to pass the "val" to a value for another text field!
would you be able to offer some suggestions!
Thanks again!
grommit168
07-16-2003, 02:50 PM
Sorry... Let me further explain the purpose of my code...
I have a form that has a command of:
onSubmit="signin(document.login)"
there are two text fields passed through when the form is submitted...
I however need to prompt the user for a 3-3-3 character input... Therefore, i need to get the concatenation of the 3 separate text fields into the one field used to login into the app...
I hope this helps...
Thanks!