simsalabim / sisyphus

Gmail-like client-side drafts and bit more. Plugin developed to save html forms data to LocalStorage to restore them after browser crashes, tabs closings and other disasters.
http://sisyphus-js.herokuapp.com
MIT License
1.99k stars 221 forks source link

Multiple checkbox not restore data #153

Open cdevassine opened 6 years ago

cdevassine commented 6 years ago

Hello, First of all, thanks for this code, it is really excellent!

I noticed a bug since v1.1.3 about multiple checkboxes (bug is not present in v1.1.2). Since v1.1.3, the getElementIdentifier() function retrieves the ID and name of a field. In fact, it fails to restore data from multiple checkboxes.

I fixed on my local code with this : function getElementIdentifier(el) { //fix get Multiple Checkbox [] var name = el.attr( "name" ); if ( name.indexOf( "[" ) !== -1 )return '[name=' + name + ']'; return '[id=' + el.attr( "id" ) + '][name=' + name + ']'; }

but it's not necessarily the best. Any idea ? ;) thank you very much !