Passing a variable to two fields - Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more
Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more
Go Back   Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more > Webmaster Tech > Programming > Other Programming - Perl, C++, Java, ASP, .NET Development

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 02-05-2010, 03:41 PM   #1 (permalink)
Junior Member
 
Join Date: May 2006
Posts: 14
Smile Passing a variable to two fields

Hi all,

Quick question, probably very easy but I don't know...

I have a very simple forum:

Code:
<FORM action=http://WEBLINK method=get>
Field1 <INPUT name=field1> 
<BR><INPUT type=submit value=Search> </FORM>
I want to pass this through the forum as field1 and field2 without the user having to enter it twice. I'm guessing it is just some javascript? Would the submit button need to read the value, copy it to a hidden field2 variable and then submit the form? BTW, I cannot duplicate the value on the page I am submitting to.

Thanks in advance!
sepple is offline   Reply With Quote
Sponsored Links
Old 02-16-2010, 03:32 PM   #2 (permalink)
Junior Member
 
Join Date: May 2006
Posts: 14
Default Re: Passing a variable to two fields

Anyone know if this is possible?
sepple is offline   Reply With Quote
Old 03-05-2010, 02:50 PM   #3 (permalink)
Junior Member
 
Join Date: Mar 2010
Location: NYC
Posts: 9
Default Re: Passing a variable to two fields

Why would you want to pass the same value twice on purpose?
To answer your question. Yes it's possible, copy value from one element to another with javascript.

document.getElementByID("element1").value=document .getElementByID("element2").value

make sure your elements have an ID.
accwebworks is offline   Reply With Quote
Old 03-05-2010, 03:33 PM   #4 (permalink)
Regular User
 
Join Date: Jan 2010
Posts: 23
Default Re: Passing a variable to two fields

You don't need javascript for that. Just create a hidden field on your form and store value there.
nice123 is offline   Reply With Quote
Old 03-05-2010, 03:41 PM   #5 (permalink)
Junior Member
 
Join Date: Mar 2010
Location: NYC
Posts: 9
Default Re: Passing a variable to two fields

I think he's talking about submitting two values. Even if you have a hidden field you need to populate its value with something, and the only way of doing it on CLIENT side is with javascript.

Last edited by accwebworks; 03-05-2010 at 04:01 PM.
accwebworks is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Sponsors

» Links

» Affiliates
Web Hosting
Online Backup Reviews
Marketing Find
Merchant Select
SiteMap Builder
Host Compare

» Links

» Sports Network
Paintball Forum
Football Forum
Hockey Forum
Golf Forum
Boxing Forum
Lacrosse Forum
Baseball Forum
SnowBoarding Forum
Soccer Forum
MMA Forum


All times are GMT -4. The time now is 04:51 PM.


Powered by vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.2
Webmaster Forums
Web Hosting | Chicago Web Hosting | Web Hosting