Hidden input name lost on `stop`
- Lingua principale
- JavaScript
- Stelle
- 7.6k
- Fork
- 981
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
I'm using the following to initialise my date picker
``` javascript
field.pickadate({ container: 'body', formatSubmit: 'yyyy/mm/dd', hiddenName: true, editable: false, selectYears: true, selectMonths: true, onClose: function() {
field.blur();
}
});
```
This works perfectly, and a new hidden element is created with the original name of the input, and the name of the input is removed. This is what I expect, and this works well with the backend server (Rails).
The form I am using this on however has the requirement of changing the field from a date picker, to something else at a different time. I therefore need to be able to destroy the date picker. I am using the `stop` function on the picker object which is working, however I noticed that when it destroys the picker, it removes the hidden field without moving the name back to the original input. I am then left with an input with no name, which then causes issues on submission.
I've been able to work around it in my own code by simply doing
``` javascript
var picker = field.pickadate('picker');
field.attr('name', $(picker._hidden).attr('name');
picker.stop();
```
But this feels a bit hacky, and I think that it is the responsibility of pickadate to clear this up since it was pickadate that moved the name in the first place.
I am currently using pickadate 3.5.6.
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.