function renderAttributes() { parent::renderAttributes(); $this->hidden_id = uniqid('js_checkbox_'); echo " onchange=\"this.form.elements['{$this->hidden_id}'].value = 1*this.checked\""; }
function renderAttributes() { parent::renderAttributes(); $this->hidden_id = uniqid('js_checkbox_'); echo " onchange=\"var el = (this.form != undefined) ? this.form.elements['{$this->hidden_id}'] : document.getElementById('{$this->hidden_id}'); el.value = this.checked * ((!isNaN(this.value*this.checked)) ? this.value : 1)\""; }