Connecting Tech Pros Worldwide Forums | Help | Site Map

Form field value into another form field?

Larry
Guest
 
Posts: n/a
#1: Jul 23 '05
I have a form that submits some js created data through a formmail script.
One field of the form is a text box for the person's name. I'd like the
subject line of the resulting email to be "Some Specific Text " + the_name.

I believe it's possible, but am lost as to the strategy?

TIA,
Larry L

Danny
Guest
 
Posts: n/a
#2: Jul 23 '05

re: Form field value into another form field?




Simple:

documet.FORMNAME.ELEMENTNAME.value='YOUR TEXT
HERE'+documet.FORMNAME.ELEMENTNAME.value;

Danny


On Thu, 30 Jun 2005 19:51:34 -0700, Larry <noway@none.com> wrote:
[color=blue]
> I have a form that submits some js created data through a formmail
> script.
> One field of the form is a text box for the person's name. I'd like the
> subject line of the resulting email to be "Some Specific Text "
> + the_name.
>
> I believe it's possible, but am lost as to the strategy?
>
> TIA,
> Larry L[/color]



--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Zif
Guest
 
Posts: n/a
#3: Jul 23 '05

re: Form field value into another form field?


Danny wrote:[color=blue]
>
>
> Simple:
>
> documet.FORMNAME.ELEMENTNAME.value='YOUR TEXT
> HERE'+documet.FORMNAME.ELEMENTNAME.value;
>
> Danny[/color]

Please do not top-post. Read the FAQ:

<URL:http://www.jibbering.com/faq>

Manually wrap lines of code, allowing auto-wrapping introduces errors.
Your code should work when copied and pasted without correction.

--
Zif
Zif
Guest
 
Posts: n/a
#4: Jul 23 '05

re: Form field value into another form field?


Larry wrote:[color=blue]
> I have a form that submits some js created data through a formmail script.
> One field of the form is a text box for the person's name. I'd like the
> subject line of the resulting email to be "Some Specific Text " + the_name.
>
> I believe it's possible, but am lost as to the strategy?[/color]

Do you mean formmail as in a server script (e.g. PHP, Perl, etc.)? If
so, do it at the server. Making your page dependent on JavaScript for
no good reason is pointless.

If you want to show your visitor what the subject will be before the
form is sent, do something like:

<form action="">
<input type="text" name="uName" size="50">Enter your name<br>
<input type="text" name="uSub" size="50" onchange="
this.form.gSub.value = this.value + ': ' + this.form.uName.value;
">Enter a subject<br>
<input type="text" name="gSub" size="50" readonly
style="border-width:0;" onfocus="
if(this.blur)this.blur();
"><br>
</form>


--
Zif
Larry
Guest
 
Posts: n/a
#5: Jul 23 '05

re: Form field value into another form field?


In article <aB5xe.2348$Zn.108889@news.optus.net.au>, Zif <zifud@hotmail.com> wrote:[color=blue]
>Larry wrote:[color=green]
>> I have a form that submits some js created data through a formmail script.
>> One field of the form is a text box for the person's name. I'd like the
>> subject line of the resulting email to be "Some Specific Text " + the_name.
>>
>> I believe it's possible, but am lost as to the strategy?[/color]
>
> Do you mean formmail as in a server script (e.g. PHP, Perl, etc.)? If
> so, do it at the server. Making your page dependent on JavaScript for
> no good reason is pointless.[/color]

Not "for no good reason". The formmail script is indeed perl, but is used for
several different forms on the site. THIS page collects test data then
asks for a name and emails the results.
[color=blue]
> If you want to show your visitor what the subject will be before the
> form is sent, do something like:[/color]

The user won't actually even see the email subject line, but it needs to start
with the same text each time so as to be correctly processed by the receiving
email client.
[color=blue]
><form action="">
> <input type="text" name="uName" size="50">Enter your name<br>
> <input type="text" name="uSub" size="50" onchange="
> this.form.gSub.value = this.value + ': ' + this.form.uName.value;
> ">Enter a subject<br>
> <input type="text" name="gSub" size="50" readonly
> style="border-width:0;" onfocus="
> if(this.blur)this.blur();
> "><br>
></form>[/color]

Thanks, I'll try a version of that. FYI, here's what I'm currently using -

Code to create $test_results

in Head
function assignvar() {
document.sendit.testresults.value=$test_results;
}

in Body
<form name="sendit" method="post" action="/cgi-bin/FormMail.pl"
onsubmit="return assignvar()">
Your Name <input type="text" name="Name_Entered" size="30">
<input type="hidden" name="subject" value="Test Results From - ">
<input type="hidden" name="from" value="Test 60">
<input type="hidden" name="testresults" value="None">
<input type="submit" value="Send Results" name="submit"></p>
</form>

Thanks,
Larry L
Larry
Guest
 
Posts: n/a
#6: Jul 23 '05

re: Form field value into another form field?


In article <1120188267.40832ff5433d644d0e5ce277a5d93a09@teran ews>, Danny <dann90038@bluebottle.com> wrote:[color=blue]
>
>
> Simple:
>
> documet.FORMNAME.ELEMENTNAME.value='YOUR TEXT
>HERE'+documet.FORMNAME.ELEMENTNAME.value;
>
> Danny
>
>[/color]

Casual to the most obvious observer!
Thanks, Larry L

[color=blue]
>On Thu, 30 Jun 2005 19:51:34 -0700, Larry <noway@none.com> wrote:
>[color=green]
>> I have a form that submits some js created data through a formmail
>> script.
>> One field of the form is a text box for the person's name. I'd like the
>> subject line of the resulting email to be "Some Specific Text "
>> + the_name.
>>
>> I believe it's possible, but am lost as to the strategy?
>>
>> TIA,
>> Larry L[/color]
>
>
>[/color]
Closed Thread