Jump to content

Optional state field


Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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? :(

Link to comment
Share on other sites

  • 5 years later...
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

Link to comment
Share on other sites

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="">&mdash;</option>' + stateops + '</select>');

to...

.append('<select name="state" class="' + jQuery("#stateinput").attr("class") + addClass + '" id="stateselect"' + statesTab + disabled + '><option>&mdash;</option>' + stateops + '</select>');

and that should let you choose the -- option without throwing a JS required field error.

Edited by brian!
Link to comment
Share on other sites

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.   Paste as plain text instead

  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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated