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

how to skip non selected select option #31

Closed
takeAction opened this issue Dec 2, 2022 · 2 comments
Closed

how to skip non selected select option #31

takeAction opened this issue Dec 2, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@takeAction
Copy link

I am using FormDataJson.toJson("#searchForm", {skipEmpty: true}), but I found that for select option:

<select name="gender">
	<option value="" selected></option>
	<option value="0" >Male</option>
	<option value="1" >Female</option>
</select>

if there is no valid option selected(that is Male or Female in this case), FormDataJson.toJson("#searchForm", {skipEmpty: true}) still return gender with null, what I suppose is to skip gender. I tried to change <option value="" selected></option> to <option ></option>, still not work.

how can I skip non selected select element?

@brainfoolong
Copy link
Owner

Thanks for your report. This issue has now been fixed in 2.1.4.

https://github.com/brainfoolong/form-data-json/releases/tag/2.1.4

@brainfoolong brainfoolong added the bug Something isn't working label Dec 2, 2022
@takeAction
Copy link
Author

Great, thanks, now it works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants