Menu
I need to put a cookie value into a form input field using Javascript.
The form is written in php and I have no way to change the code or change the name of the input field.
I have a Cookie function that gets the cookie (get_Cookie). the Cookie name is “Referredby”.
The form name is “editform” and the input field name is “FormField[2][32]”
Would this be the correct way to put the value of the cookie into the form field?
[CODE]<script type=”text/javascript”>
function putcookie() {
var refer = ( get_Cookie( ‘Referredby’ ) );
document.forms[“editform”].elements[“FormField[2]”][32] = refer;
}
</script>
Thanks for your help