So – I was toiling away on some client side code, and noticed that a dropdown value was not being sent on a post command. After much rending of garments and gnashing of teeth I figured it out. I was setting the value with a .val(“something” command) – then doing the post. It would seem that if you are doing that immediately the value is not quite in the dropdown yet (probably some DOM thing) and rather than send a null value it will omit the dropdown entirely on the serialization, and not send it on the post.
The solution is to
- manually add the value as an option in the dropdown
- then set that value with the .val() command
- then serialize the form
- then do the post.
|
Written By Steve French |
Leave a Reply