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!

Setting variables from user input

Status
Not open for further replies.

AGNEW2PRG

Technical User
Aug 5, 2003
98
AE
Hi All,

I have designed a html form that collects the user input and emails it to an address.

FORM FIELDS
----------------------------

form field 1 : Title
form field 2 : First Name
form field 3 : Last Name


I am trying to set a hidden field value(Full Name) using the 3 form fields. to give me :

Full Name = form field 1 + form field 2 + form field 1

Eg: Mr. Joe Bloggs

Bit stuck, unfortunately the server does not support ASPpages, I would prefer to run the scripting elements of the form on the server, as I have been advised that alot of firewall/filtering tools block client side scripting these days..

Any help will be most appreciated..Many thanks

-
 
Hi all,

I have the Client side script working. how do i now assign the vbscript variable value to the hidden field..

regards
 
Hi Barney,

Thanks for your reply.. I think I'm still missing something.. here is the code that I am using.

<script language="vbscript">
sub submit_onSubmit
dim fullname
fullname = (inforequest.title.value)+ ". " + (inforequest.first_name.value)+ " " + (inforequest.last_name.value)
(inforequest.fullname.value)=fullname
end sub
</script>


<html>
<input name="fullname" type="hidden" id="fullname">
</html>


Where am I going wrong.. thanks ..

Regards
 
Whatever those lines meant, use this as the reference to read or write to the value of the hidden box.
[tt] document.getElementById("fullname").value[/tt]
 
the <html> should be wrapped around the script. i tried this code without the hidden type, and it displayed the string in the input box. so the code works.



<html>

<script language="vbscript">
sub submit_onSubmit
dim fullnamex
first_nam = "first name"
last_name = "last name"
initials = "initial"
fullnamex = first_nam & "-" & last_name & "-" & initials
' fullnamex = (title.value)& ". " + (first_name.value)& " " & (last_name.value)
fullname.value =fullnamex
end sub
</script>

<body>

<input name="fullname" id="fullname"> <br>
<input type="button" value="submit" name="run_button3" onClick="submit_onsubmit">

</body>
</html>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top