vendredi 4 avril 2014

Multicheckbox field returns array, but string if only the last one is checked

If I have a multicheckbox (more checkboxes with same name, different values), and I getValues on it, I ususally get array of selected values (and nulls for not checked fields). But if I check only the last checkbox, I'll get a string insted. It should always return an array.



Here is the fiddle http://ift.tt/1mHNQWA



See also the console output:







Both checked:

  • ingredients: Array[2]

    • 0: "tomato"

    • 1: "salami"

    • length: 2






First one checked:


  • ingredients: Array[2]

    • 0: "tomato"

    • 1: null

    • length: 2




Second one checked:


  • ingredients: "salami"






Aucun commentaire:

Enregistrer un commentaire