Comments (8)
@EnricoU i think the use case here is that calling deserialize
on the form will potentially not properly set multiple select list values if there are existing values on the element -- basically after deserialization the form values would be in an invalid state because they don't match what was serialized.
from jquery-deserialize.
@dshiryaev-plesk hmm, why hardcode selected="selected"
if you don't want it?
from jquery-deserialize.
But it does seem like a bug, so I will look at it soon.
from jquery-deserialize.
It's just for the example. If you delete selected="selected", then select the options manually, then run javascript code, you will get the same result.
@dshiryaev-plesk hmm, why hardcode selected="selected" if you don't want it?
from jquery-deserialize.
@dshiryaev-plesk please try out https://github.com/kflorence/jquery-deserialize/releases/tag/2.0.0-rc1
from jquery-deserialize.
I think there is no need to update the selected attribute programmatically as the browser will automatically know which element is selected. The selected attribute is intended to set a default option on page load.
From: https://www.w3schools.com/tags/att_option_selected.asp
"When present, it specifies that an option should be pre-selected when the page loads."
A pre-selected option seems "selected", but the $('#selectid option:selected').val()
command just returns the new value set by the deserialization function.
from jquery-deserialize.
@kflorence, exactly.
from jquery-deserialize.
Closing, as this should have been addressed with #39.
from jquery-deserialize.
Related Issues (20)
- Multiple selects with same name are not deserialized properly HOT 3
- checking for undefined with typeof
- checkboxes without value are not properly deserialized HOT 5
- Request: refactor deserialize into reusable function so that it returns an object HOT 2
- Support CakePHP checkbox HOT 1
- Deserialize data to be used in script. HOT 3
- Does not work with nested field names HOT 6
- Minified version does not properly deserialize some selects HOT 2
- When a field is not found, the change callback is not called HOT 2
- how about npm?) HOT 2
- with disabled the deserialize not working HOT 2
- npm install: missing files HOT 1
- Force adding options to multi select HOT 1
- RFE: deserialize function should fire change events HOT 2
- Could we get it to deserialize complex objects HOT 1
- handle JSON boolean values for checkboxes true/false values HOT 2
- Error when loading the plugin HOT 1
- Dual licence HOT 2
- Will there be a new release? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jquery-deserialize.