NaniG Posted October 1, 2012 Share Posted October 1, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/268963-papulated-one-text-filed-values-into-another-text-filed-values/ Share on other sites More sharing options...
Mahngiel Posted October 2, 2012 Share Posted October 2, 2012 Free code! I wanted the practice: http://jsfiddle.net/Mahngiel/6Gkjz/ Quote Link to comment https://forums.phpfreaks.com/topic/268963-papulated-one-text-filed-values-into-another-text-filed-values/#findComment-1382149 Share on other sites More sharing options...
codefossa Posted October 2, 2012 Share Posted October 2, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/268963-papulated-one-text-filed-values-into-another-text-filed-values/#findComment-1382155 Share on other sites More sharing options...
NaniG Posted October 8, 2012 Author Share Posted October 8, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/268963-papulated-one-text-filed-values-into-another-text-filed-values/#findComment-1383653 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.