Desperate for a little html / cgi help --
Aug. 19th, 2003 12:17 pmI'm trying to figure out how to make a form field entry become a hidden input value. Anyone who knows anything about html forms and a little cgi, please read:
I have a form which includes the following hidden input value:
<INPUT name="mailfrom" type="hidden" value="Network Chicago - Contact Form">
So that when the form data is submitted, the "from" in the email says "Network Chicago - Contact Form".
What I would *like* the "from" to be is the person's email - which they are putting into the form itself in a field defined thusly -
<INPUT name="email" type="text" size="30">
I would like to somehow make this:
<INPUT name="mailfrom" type="hidden" value="xxx">
where "xxx" equals the value input to the "email" form field.
If anyone can figure this out and can explain it to me - PLEASE HELP.
Many, many thanks.
I have a form which includes the following hidden input value:
<INPUT name="mailfrom" type="hidden" value="Network Chicago - Contact Form">
So that when the form data is submitted, the "from" in the email says "Network Chicago - Contact Form".
What I would *like* the "from" to be is the person's email - which they are putting into the form itself in a field defined thusly -
<INPUT name="email" type="text" size="30">
I would like to somehow make this:
<INPUT name="mailfrom" type="hidden" value="xxx">
where "xxx" equals the value input to the "email" form field.
If anyone can figure this out and can explain it to me - PLEASE HELP.
Many, many thanks.
no subject
Date: 2003-08-19 11:31 am (UTC)onClick="form.mailfrom.value=form.email.value;"If for whatever reason you can't trigger it via a button, you could put it inside the code for the email field, so the mailfrom value is updated as soon as that field loses focus:
<INPUT name="email" type="text" size="30" onBlur="form.mailfrom.value=this.value;" >no subject
Date: 2003-08-19 11:38 am (UTC)no subject
Date: 2003-08-19 11:40 am (UTC)<A href="javascript:document.form1.submit()"><IMG src="/images/submitform.gif" border="0" width="90" height="20">
where should I put your bit of script?
no subject
Date: 2003-08-19 11:48 am (UTC)<A href="javascript: form1.mailfrom.value=form1.email.value; document.form1.submit()">no subject
Date: 2003-08-19 12:17 pm (UTC)using this script, the email "from" field comes in as
From: Value defined in hidden field <"emailfield@email.com">
and when hitting reply, the "to" in the reply is "Value defined in hidden field" and doesn't actually go the email address.
Does any of that make sense, and how do I solve it?
no subject
Date: 2003-08-19 01:11 pm (UTC)Um. Things that might or might not help at all...
I'm not sure it would make a difference, but maybe it would help if where I've said to use "
form1.mailfrom.value=form1.email.value" you make each of those "document.form1" - I don't think that's the problem, but maybe it's not finding the objects properly without the complete address.You could try splitting it into two statements so there's a temporary variable in the middle instead of directly assigning one value to another. Something like:
<A href="javascript:var temp=form1.email.value;
form1.mailfrom.value=temp;
document.form1.submit()">
Sometimes Javascript throws funny turns about things like that.
If it's still not working, I'd suggest put in a couple of alert boxes before and after executing the statement to try and see what's happening:
<A href="javascript:alert(form1.email.value);
form1.mailfrom.value=form1.email.value;
alert(form1.mailform.value);
document.form1.submit()">
See if the alert boxes come up with the actual values you want to be assigned, or if they come up with something like "[object]" or whatever bizarre message you're getting instead.
Hmm. Maybe I'll fiddle around with some Javascript and see if I can figure out what's going on there.