Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

data-default-value not set for region if only 1 country #75

Open
patrick-levesque opened this issue Nov 27, 2018 · 3 comments
Open

data-default-value not set for region if only 1 country #75

patrick-levesque opened this issue Nov 27, 2018 · 3 comments
Labels
Milestone

Comments

@patrick-levesque
Copy link

patrick-levesque commented Nov 27, 2018

Hi! I'm trying to use this library with only 1 country (US to start with but will add other later) and when I try to set data-default-value for region with previous form value or default to 'California', region dropdown always shows 1st value 'Alabama'. Works well if I have 2 countries or more (ex. US and Canada).

Tried a custom build with grunt customBuild --countries="United States" or using the data-whitelist="US" with all countries.

Here's the code:

<select id="country" name="country" class="form-control input-fields crs-country" data-whitelist="US" data-region-id="province" data-default-value="United States" data-show-default-option="false"></select>

<select id="province" name="province" class="form-control input-fields" data-default-value="California" data-show-default-option="false"></select>

Thanks!

@patrick-levesque
Copy link
Author

Quick workaround is to set data-default-value to the desired country, "hide" the country select (display: none;) and show its value in a dummy input field or <p> tag. But this still requires at least 2 countries in the custom build to work.

Would be nice to only update library custom build with new countries without touching each forms in the code...

@benkeen benkeen added the Bug label Nov 28, 2018
@benkeen
Copy link
Member

benkeen commented Nov 28, 2018

Hey @paralel-github, thanks for the heads up. Bug! I'll patch this in the next release - you shouldn't have to do a workaround for this.

@benkeen benkeen added this to the 0.5.2 milestone Nov 28, 2018
@chung1905
Copy link

Hello @benkeen

I create a pull request to fix this issue, can you please check?

Thank you for the awesome projects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants