Does any of you demi-Gods have any idea why a checkbox has a “checked”-property and a “value”-property? And which real world scenario would differentiate between the two (e.g checked=true, value=false)? Never really used checkboxes before because they are dangerous (binding a tri-value db-element to a bi-value interface element).
Hey hey hey Giri!
The value doesn’t necessarily have to be a boolean one.
Let’s say I want to make an order for dinner at my local favorite fast-food burger chain.
This said chain gives me the option to track the number of calories in the food I’ve ordered.
When submitting an order I’ll check all the items on the menu that I want and they’ll send 'em according to the checked properties of the items but at the same time, they can sum the calories that are being assigned to the item’s value.
The value is ignored while submitting an entry via dataset to a collection.
What’s being submitted as the element value in the collection is the checked property as a boolean type.
Hope that helps.
Doron.
OK, that makes kind of sense. Thanks, I overlooked the fact that the value-property is of type String. Just to be clear for others: if you do not use datasets, but wix-data to bind form elements to collection, you should use the “checked”-property, not the value-property. And yes, this makes binding harder: for most elements, you write the value-property, but for img’s the src-property and for checkboxes the checked-property.