Google Answers Logo
View Question
 
Q: how to combine field values (follow-up, "forms and prompts in HTML/Javascript") ( No Answer,   4 Comments )
Question  
Subject: how to combine field values (follow-up, "forms and prompts in HTML/Javascript")
Category: Computers > Programming
Asked by: fieldlily-ga
List Price: $5.00
Posted: 30 Nov 2005 17:22 PST
Expires: 30 Dec 2005 17:22 PST
Question ID: 599753
Hello,

Having gotten a great answer from palitoy-ga to my previous question,
I played around with the code and managed to get a little bit farther
on my own. I found that I could get the page to display the text from
two fields in a third field by using something like the following:

<input type="text" name="first">
<input type="text" name="second">

<input type="button" value="Submit"
onClick=" document.all.third.value = document.all.first.value +
document.all.second.value ">
<input type="text" name="third">

Is there a way that I can get the page to add a space, or other
characters, between the values of the first and the second field when
they are displayed in the third field?

Thank you very much. ~fieldlily-ga
Answer  
There is no answer at this time.

Comments  
Subject: Re: how to combine field values (follow-up, "forms and prompts in HTML/Javascript")
From: document123-ga on 01 Dec 2005 03:12 PST
 
It's as simple as this

<input type="text" name="first">
<input type="text" name="second">

<input type="button" value="Submit"
onClick=" document.all.third.value = document.all.first.value + ' ' +
document.all.second.value ">
<input type="text" name="third">

If you need text instead of a space - place it in the single quotes.
Subject: Re: how to combine field values (follow-up, "forms and prompts in HTML/Javascrip
From: fieldlily-ga on 01 Dec 2005 08:23 PST
 
Thank you very much, document123-ga, that's a big help. I had tried it
with double quotes, but using single quotes didn't occur to me.

If you want the $5, it's yours; I'm sure it was trivial to you it was
worth $5 to me.

Thanks again.
Subject: Re: how to combine field values (follow-up, "forms and prompts in HTML/Javascript")
From: document123-ga on 02 Dec 2005 03:41 PST
 
No problem fieldlily - I'm not a researcher anyway - just helping out
where I can - I've had some great free help in the past - thought I'd
'return' the favour.
Subject: Re: how to combine field values (follow-up, "forms and prompts in HTML/Javascrip
From: fieldlily-ga on 03 Dec 2005 16:01 PST
 
Well, thank you very much again!

~fieldlily

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy