JavaScript Bs_Checkbox example 2
This is an example of the Checkbox Control.
- Ignore the "Email" text field.
- The first checkbox "Newsletter" is a conventional one. The text "Yes please" uses the label tag to make it clickable too.
- The second checkbox "Spam" is a conventional too, but is converted into a Bs_Checkbox on the fly using convertField(). It uses a custom icon. Unfortunately, because of the transformation, the label tag on the text "Yes please" does not work anymore.
- The third checkbox "Money" works like the "Spam" one. But the conversion is done on a wrapping span tag. This way the caption is spitted out along with the Bs_Checkbox, and thus it is still clickable. Same with the onmouseover.
- All 3 checkbox field have a default "value" setting of "1". The first field, as it is not touched, keeps that. The later 2 fields, when checked submitted, send the value "2" to the server. This is because the Bs_Checkbox supports "partly" checked boxes, which then use the reserved value "1". Rule of thumb: If you receive the checkbox on the server, it was checked, no matter what the value is.