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 10:38 am (UTC)no subject
Date: 2003-08-19 10:39 am (UTC)no subject
Date: 2003-08-19 10:46 am (UTC)Try javascript.internet.com? You might be able to find the answer there...
no subject
Date: 2003-08-19 10:48 am (UTC)Anyway I think you can just assign it to a variable and then put that in the value for the mailfrom field
/********************************************/
var EMAILVALUE = TheForm.email.value
<input ... >
no subject
Date: 2003-08-19 10:52 am (UTC)But the second line was this:
INPUT name="mailfrom" type="hidden" value="% =EMAILVALUE %"
no subject
Date: 2003-08-19 10:57 am (UTC)actually, do you have any chatting capabilities - AIM, irc, anything? I'd like to go through this step by step with you like the big dork I am.
Do you have a few minutes?
no subject
Date: 2003-08-19 10:58 am (UTC)And of course the ones that encloses that line too. *g*
no subject
Date: 2003-08-19 11:01 am (UTC)no subject
Date: 2003-08-19 11:07 am (UTC)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.
no subject
Date: 2003-08-19 05:54 pm (UTC)What cgi script are you using? Is it custom or is it just FormMail? The script name should be in the <form> tag. If it's FormMail, that's pretty customizable and I could go through the docs to see what's what.
Actually, have you tried leaving out the hidden mail-from field altogether? It might then default to simply using the email value.