bullfrog3459 Posted May 30, 2010 Share Posted May 30, 2010 Looks like you are missing this from the top of the js file The zip attached is the complete file that I have in my dev and it works fine Thanks Sparky, but i was not missing that, it was at the top of the file that i had, i just has the main information for the js file. However, i did go ahead and download your file and checked with mine and also just uploaded yours, still no go. this is what i get still: I have added my statedropdown.js (the one from you) and clientregister.tpl here to see if i have messed something up. Thanks for the help! statedropdown.zip 0 Quote Link to comment Share on other sites More sharing options...
jvriends Posted May 30, 2010 Share Posted May 30, 2010 var ar = new Array(); ar['CA'] = "<option>Alberta</option><option>British Columbia</option><option>Manitoba</option><option>New Brunswick</option><option>Newfoundland and Labrador</option><option>Northwest Territories</option><option>Nova Scotia</option><option>Nunavut</option><option>Ontario</option><option>Prince Edward Island</option><option>Quebec</option><option>Saskatchewan</option><option>Yukon Territory</option>"; jQuery(document).ready(function(){ jQuery("#country").change(function() { var country = jQuery(this).val(); if (ar[country]) { jQuery("#state").hide(); if (ar[country].indexOf('=')==-1) { jQuery("#statedropdown").html('<select id="statedd"><option>'+ar[country].replace(/\174/g,"</option><option>")+'</option></select>'); }else{ jQuery("#statedropdown").html('<select id="statedd"><option value="'+ar[country].replace(/\075/g, '">').replace(/\174/g,'</option><option value="')+'</option></select>'); } jQuery("#state").val(jQuery("#statedd").val()); } else { jQuery("#state").val(''); jQuery("#state").show(); jQuery("#statedropdown").html(''); } }); jQuery("#statedd").livequery("change", function(event) { jQuery("#state").val(jQuery(this).val()); }); var country = jQuery("#country").val(); var state = jQuery("#state").val(); if (ar[country]) { jQuery("#state").hide(); if (ar[country].indexOf('=')==-1) { jQuery("#statedropdown").html('<select id="statedd"><option>'+ar[country].replace(/\174/g,"</option><option>")+'</option></select>'); if (jQuery("#state").val() == 'Alberta') { $("#statedropdown option:contains('Alberta')").attr("selected","selected"); } if (jQuery("#state").val() == 'British Columbia') { $("#statedropdown option:contains('British Columbia')").attr("selected","selected"); } if (jQuery("#state").val() == 'Manitoba') { $("#statedropdown option:contains('Manitoba')").attr("selected","selected"); } if (jQuery("#state").val() == 'New Brunswick') { $("#statedropdown option:contains('New Brunswick')").attr("selected","selected"); } if (jQuery("#state").val() == 'Newfoundland and Labrador') { $("#statedropdown option:contains('Newfoundland and Labrador')").attr("selected","selected"); } if (jQuery("#state").val() == 'Northwest Territories') { $("#statedropdown option:contains('Northwest Territories')").attr("selected","selected"); } if (jQuery("#state").val() == 'Nova Scotia') { $("#statedropdown option:contains('Nova Scotia')").attr("selected","selected"); } if (jQuery("#state").val() == 'Nunavut') { $("#statedropdown option:contains('Nunavut')").attr("selected","selected"); } if (jQuery("#state").val() == 'Ontario') { $("#statedropdown option:contains('Ontario')").attr("selected","selected"); } if (jQuery("#state").val() == 'Prince Edward Island') { $("#statedropdown option:contains('Prince Edward Island')").attr("selected","selected"); } if (jQuery("#state").val() == 'Quebec') { $("#statedropdown option:contains('Quebec')").attr("selected","selected"); } if (jQuery("#state").val() == 'Saskatchewan') { $("#statedropdown option:contains('Saskatchewan')").attr("selected","selected"); } if (jQuery("#state").val() == 'Yukon Territory') { $("#statedropdown option:contains('Yukon Territory')").attr("selected","selected"); } }else{ if (state=='') { jQuery("#statedropdown").html('<select id="statedd"><option value="'+ar[country].replace(/\075/g, '">').replace(/\174/g,'</option><option value="')+'</option></select>'); }else{ states = '<option value="'+ar[country].replace(/\075/g, '">').replace(/\174/g,'</option><option value="')+'</option>'; jQuery("#statedropdown").html('<select id="statedd">'+states.replace(state+'"', state+'" selected="selected"')+'<option>dd</option></select>'); } } jQuery("#state").val(jQuery("#statedd").val()); } else { jQuery("#state").show(); jQuery("#statedropdown").html(''); } }); 0 Quote Link to comment Share on other sites More sharing options...
jvriends Posted May 30, 2010 Share Posted May 30, 2010 A few more things. clientregister.tpl is only called when a new user registered and not when placing an order. Make sure you are testing going to your site and just registering without ordering a product. Also make sure your WHMCS settings are set to use the template that you modified the clientregister.tpl in. Stuff that I am sure you already know and have done, but must making sure 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted May 30, 2010 Share Posted May 30, 2010 (edited) You have a java error "PreLoad is not defined" Is there a reason why you have 2 body tags? You need to define the java PreLoad function!! <body><body onload="javascript:PreLoad()"> Also you are only defining the dropdown in the register page which is workinghttp://exaltedservers.com/billing/register.php Edited May 30, 2010 by sparky 0 Quote Link to comment Share on other sites More sharing options...
bullfrog3459 Posted May 30, 2010 Share Posted May 30, 2010 You have a java error"PreLoad is not defined" Is there a reason why you have 2 body tags? You need to define the java PreLoad function!! Also you are only defining the dropdown in the register page which is working http://exaltedservers.com/billing/register.php Wow! Thanks Sparky! Just seems to be my day of being an idiot! Also thanks jvriends =] both have been amazing and helpful! I will take a look into fixing my preload issue here in just a few minutes. Now as far as this module is concerned is it only going to work on register.php and not when going through and ordering then? Thanks for the some clarification! 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted May 30, 2010 Share Posted May 30, 2010 you can also use it in viewcart.tpl within your cart template 0 Quote Link to comment Share on other sites More sharing options...
jvriends Posted May 30, 2010 Share Posted May 30, 2010 In order to implement this system wide (which I just did today), you will need to modify the .tpl files for contactview, contactadd, clientdetails, and the orderform templates. The variables on each of these templates are not identical to the initial post from Matt, so paste the stuff above the current entries and adjust the variables as required. One user posted a statedropdown.js that remembered the value of an existing client, and displayed a textbox. As I felt this was a risk, as users could enter in wrong details when changing their state, I modified it to use a drop down, it is messy, and I wonder if someone can help me get rid of the if statements, but it works. check my statedropdown.js above 0 Quote Link to comment Share on other sites More sharing options...
Milliment Posted September 5, 2010 Share Posted September 5, 2010 Hi guys I would like to make an alteration if possible please. In italy we do not use regions for addresses. We use Province's. So i have included the Correct Province List for anyone who wants it : Please replace the following Line : ar['IT']="Abruzzi|Basilicata|Calabria|Campania|Emilia-Romagna|Friuli-Venezia Giulia|Lazio|Liguria|Lombardia|Marche|Molise|Piemonte|Puglia|Sardegna|Sicilia|Toscana|Trentino-Alto Adige|Umbria|Valle d'Aosta|Veneto"; With : ar['IT']="AG|AL|AN|AO|AR|AP|AT|AV|BA|BL|BN|BG|BI|BO|BZ|BS|BR|CA|CL|CB|CI|CE|CT|CZ|CH|CO|CS|CR|KR|CN|EN|FE|FI|FG|FC|FR|GE|GO|GR|IM|IS|SP|AQ|LT|LE|LC|LI|LO|LU|MC|MN|MS|MT|ME|MI|MO|NA|NO|NU|OT|OR|PD|PA|PR|PV|PG|PU|PE|PC|PI|PT|PN|PZ|PO|RG|RA|RC|RE|RI|RN|RM|RO|SA|VS|SS|SV|SI|SR|SO|TA|TE|TR|TO|OG|TP|TN|TV|TS|UD|VA|VE|VB|VC|VR|VV|VI|VT"; Hope this helps. 0 Quote Link to comment Share on other sites More sharing options...
wsd Posted October 21, 2010 Share Posted October 21, 2010 Hi I would like to make an alteration. In Denmark we do not use regions or province's for addresses but we can use regions, so here is the correct list of regions: So replace the following Line : ar['DK']="Arhus|Bornholm|Fredericksberg|Frederiksborg|Fyn|Kobenhavn|Kobenhavns|Nordjylland|Ribe|Ringkobing|Roskilde|Sonderjylland|Storstrom|Vejle|Vestsjalland|Viborg"; With : UTF-8 ar['DK']="Hovedstaden|Nordjylland|Midtjylland|Syddanmark|Sjælland"; Best regards, 0 Quote Link to comment Share on other sites More sharing options...
cyfered6 Posted November 25, 2010 Share Posted November 25, 2010 Hi, I know this is an hold thread but maybe someone can help me with that. What i have to change in the viewcart.tpl for that to work. Work fine with register.tpl Regards 0 Quote Link to comment Share on other sites More sharing options...
Snowman Posted November 27, 2010 Share Posted November 27, 2010 Ive added this great bit of code to our site on the clientregister and client contact pages and while its displaying everyting correctly no matter what i do as soon as i save the page and it refreshes it shows the first state in the dropdown for the selected company anyone have any ideas why this would be occuring? 0 Quote Link to comment Share on other sites More sharing options...
stumblrmonk3 Posted December 2, 2010 Share Posted December 2, 2010 Can we port these changes to the Admin side of the WHCMS somehow? I say that because we don't have a frontend for customers at all, we just have the backend that our employees use and it's pretty hard dealing with states being text fields. Some employees type out the whole name "New York" while others put in "NY" so you don't know which one to search for later. Also, why not use abbreviations for states? I saw the code only has full state names and I saw a mod that used some sort of abbreviation. Thanks! 0 Quote Link to comment Share on other sites More sharing options...
toprankseo Posted February 2, 2011 Share Posted February 2, 2011 Has anyone done a UK one of these and got it working? 0 Quote Link to comment Share on other sites More sharing options...
maelse Posted February 23, 2011 Share Posted February 23, 2011 I have a problem with the file "clientareadetails.tpl". I have changed as the manual says, but when the client accesses your contact details, the field state/province is empty. Can someone help me with that? Thanks. 0 Quote Link to comment Share on other sites More sharing options...
Manchester Web Hosting Posted July 17, 2011 Share Posted July 17, 2011 Has anyone done a UK one of these and got it working? Yup UK one up and running, just follow instructions above, good luck 0 Quote Link to comment Share on other sites More sharing options...
rob2 Posted October 15, 2011 Share Posted October 15, 2011 Hello,if i hope to add zip,does anyone hope how to do it ? thank you 0 Quote Link to comment Share on other sites More sharing options...
rob2 Posted October 22, 2011 Share Posted October 22, 2011 Hello,it is 2 degree now,is it possible customize it into 3 or more degree ? thank you 0 Quote Link to comment Share on other sites More sharing options...
cyberneticos Posted October 24, 2011 Share Posted October 24, 2011 Hello, I need to change the encoding of the values. Not showing up correctly using UTF-8 as default in my whmcs installation. ¿ Is it possible to change these values ? 0 Quote Link to comment 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.