View Full Version : passing variable to a hidden form field
06-29-2006, 04:32 PM
ok. i just need to know the syntax to send a variable to a hidden form field from within a function. i know it's simple, but my brain is fried already this week. thank you!
the field's name is "sendItems" and the form's name is "sampleform".
06-29-2006, 04:40 PM
document.FormName.FieldName = "SomeValue"
06-29-2006, 04:52 PM
so it would be:
return document.formName.fieldName = "myVar"
06-29-2006, 05:46 PM
06-29-2006, 06:43 PM
why would you need to return anything? The statement document.formname.fieldname.value = "somevalue" assigns the text "somevalue" to the value of the field "fieldname" that sits in the form "formname"
No need for a return.
06-30-2006, 08:08 AM
document.getElementById("FieldName").value = "something"
You'll need to give your hidden field an id, but this is better for cross-browser support.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.