Qhiliqq Posted May 1, 2016 Share Posted May 1, 2016 Hello, I've got a problem with my WHMCS customation. I want to set the state field in registration etc. to optional. If I check the tickboxes in Setup->Other->Optional Client Profile Fields this is just the same as without the check. The database is updated correctly. The register.php site shows this: <select name="state" class="undefined" id="stateselect" 0 required="required"> The required thing there, how I can disable it? Regards, Philipp 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted May 2, 2016 Share Posted May 2, 2016 Philipp, which version and template of WHMCS are you using? I just tried this in v6.3.1, using both Five and Six templates and it seems to work fine - and the code doesn't look like the code above. I assume that you are using a custom template - if so, then you should probably contact the author for an updated version. 0 Quote Link to comment Share on other sites More sharing options...
Qhiliqq Posted May 2, 2016 Author Share Posted May 2, 2016 Hello Brian, thanks for your reply. My WHMCS Version is the same as yours: 6.3.1 I've build my own theme in V5.3.3 and upgrade after that to V6. The clientregister.tpl is copied from the six theme... The check in Setup->Other->Optional Client Profile Fields is set to yes at stat, so this shouldn't be required... Some other ideas? 0 Quote Link to comment Share on other sites More sharing options...
Qhiliqq Posted May 2, 2016 Author Share Posted May 2, 2016 EDIT: Found it here: /assets/js/StatesDropdown.js in line 70 Just delete this line and your done 0 Quote Link to comment Share on other sites More sharing options...
AzeDK Posted June 3, 2021 Share Posted June 3, 2021 On 5/1/2016 at 8:49 PM, Qhiliqq said: I've got a problem with my WHMCS customation. I want to set the state field in registration etc. to optional. If I check the tickboxes in Setup->Other->Optional Client Profile Fields this is just the same as without the check. The database is updated correctly. The register.php site shows this: <select name="state" class="undefined" id="stateselect" 0 required="required"> The required thing there, how I can disable it? It has not been working since first release, and still not working now. Its very frustrating, and misleading to be able to set the state field optional in WHMCS > System Settings > General Settings > Other > Optional Client Profile Fields, but the clientarea details pages and order pages still enforce the field as required for most countries. The only solution we found was to hardcode edit the inclusion of StatesDropdown.js in the /templates/twenty-one/clientareadetails.tpl file to the following (I suggest making your own Child Theme, to keep changes after WHMCS updates): <script type="text/javascript" src="{$BASE_PATH_JS}/StatesDropdown2.js"></script> And then copy the /assets/js/StatesDropdown.js file to StatesDropdown2.js and add our own country code "states": states['DK'] = ["","Hovedstaden","Sjælland","Nordjylland","Midtjylland","Syddanmark","end"]; Leaving the first option empty, for clients not wishing to bloat their invoice details with this unwanted state field. Please give some love for this feature request Allow State/Region Overrides 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted June 3, 2021 Share Posted June 3, 2021 (edited) if you're going to edit statesdropdown, then you could try removing the value="" part... .append('<select name="state" class="' + jQuery("#stateinput").attr("class") + addClass + '" id="stateselect"' + statesTab + disabled + '><option value="">—</option>' + stateops + '</select>'); to... .append('<select name="state" class="' + jQuery("#stateinput").attr("class") + addClass + '" id="stateselect"' + statesTab + disabled + '><option>—</option>' + stateops + '</select>'); and that should let you choose the -- option without throwing a JS required field error. Edited June 3, 2021 by brian! 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.