HTML Tutorial


 Forum HomeForum Home   FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
RegisterRegister - Not registered yet? Got something to say? Join HTML Code Tutorial!
How to pass form value to hidden variable on same page
Post new topic   Reply to topic    HTML Help Forum Index -> HTML Form
View previous topic :: View next topic  
Author Message
bc_salem



Joined: 22 Apr 2008
Posts: 3

PostPosted: Tue Apr 22, 2008 7:17 am     How to pass form value to hidden variable on same page Reply with quote

I have a html page with a form in it. The form prompts for a state code as well as other address information. I need to populate a second state code field with the entry first selected without prompting the user twice. How can I set the value of the hidden field to the value of the select form field?
bc_salem



Joined: 22 Apr 2008
Posts: 3

PostPosted: Wed Apr 23, 2008 6:16 am     Clarification of problem Reply with quote

Let me explain further, on the first line of code I get the state value from the user. I then need to use this same state value for the TaxJurisdiction variable without prompting the user for thsi a second time.

<INPUT class="textbox" type="TEXT" maxLength=2 name="Applicants.State" size=30>

<INPUT type="hidden" name="Applicants.TaxJurisdiction" value="<Applicants.State/>">

Can someone please explain how to do this?
Sarvesh



Joined: 17 May 2008
Posts: 3

PostPosted: Sat May 17, 2008 3:41 am     Hi Reply with quote

You can do one thing, just call a function on entering value in the state field. may be on onchange or onblur. k. then in that function set the value of your second field to be the first one.

ie.
var first = document.forms[0].<first field>.value ;
document.forms[0].<second field>.value = 'first';
bc_salem



Joined: 22 Apr 2008
Posts: 3

PostPosted: Tue May 20, 2008 8:21 am     Thanks! Reply with quote

Yes, this works as I called a function from the onchange event.

Thanks for your reply!!!
Display posts from previous:   
Post new topic   Reply to topic    HTML Help Forum Index -> HTML Form All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
HTML Help Archive
Powered by phpBB © 2001, 2005 phpBB Group
HTML Help topic RSS feed 

 
HOSTING / DESIGN
MAKE MONEY

Home
  |   Tutorials   |   Forum   |   Quick List   |   Webmaster Directory   |   About
Copyright ©1997-2002 Idocs and ©2002-2007 HTML Code Tutorial