Jump to content

Papulated One Text Filed Values Into Another Text Filed Values


NaniG

Recommended Posts

Hi to all,

 

In my registration page, i have a headers like Company Information, Contact Information and etc.

 

Fields in company information :

 

Company Name, Address1, Address2, City, Country, State, ZipCode

 

Fields in Contact Information :

 

First Name, Middle Name, Last Name, Email Address, Phone, Address1, Address2, City, Country, State, ZipCode.

 

Country and State are two dropdowns and depending upon the selected country name the states will be appear. Am fetching the values from javascript instead of mysql database. (http://bdhacker.sour...ript/countries/)

 

 

I have a checkboxes Whether the Contact address is as same as the company address with "Yes" or "No".

When User cheks the "Yes" checkbox, then the Company Address text Filed values will be papulated in the respective Contact Information textbox fileds. If he cheks "No" checkbox, the Contact information fields will be validated.

 

Please suggest me how can i solve my problem.

Link to comment
Share on other sites

I would add a hidden field whether it's the same or not. Then with Javascript, you can hide the extra information area and put "same as above" or whatever .. You could just change the value of the hidden field, and it would clean up the page a bit rather than having two big sets of the same thing.

 

Just a checkbox to toggle the area and value of the hidden field.

Link to comment
Share on other sites

Thanks Mahngiel and Kira ...

 

Every thing is fine done according your suugestions. But in the State Dropdown of Contact Information section, that particular state value is not populated.

 

var stateIndex = document.getElementById('cmpystate').selectedIndex;

var stateText = document.getElementById('cmpystate').options;

alert("Index: " + stateText[stateIndex].index + " is " + stateText[stateIndex].text);

var StateValue = document.getElementById('contact_state').options[document.getElementById(cmpystate').selectedIndex].text;

alert(StateValue);

 

Its showing nothing. as am using the javascript to get the Countrues and State from http://bdhacker.sourceforge.net/javascript/countries/

 

Can you people please suggested me.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.