html5 - pfbc checkbox all options required -


i using pfbc checkbox, , want make options have attribute required, html5 validation.

following code sent pfbc rendering, doesn't add 'required' attribute:

array (                 'name' => 'agreements',                 'label' => '',                 'type' => 'checkbox',                 'options' => array('over_18'=>'i on 18 years of',                             'understand_risks'=>'i understand risks',                 'properties'=> array (                         'required' => array('over_18','understand_risks')                 )         ), 

i have found answer in forum. fix needed in pfbc/element/checkbox.php, removing 'required' option below. after html5 validation checkboxes works charm!

--- a/pfbc/element/checkbox.php +++ b/pfbc/element/checkbox.php @@ -24,7 +24,7 @@ class element_checkbox extends optionelement {                         $value = $this->getoptionvalue($value);                          echo '<label class="', $labelclass, '">'; -            echo '<input id="', $this->_attributes["id"], '-', $count, '"', $this->getattributes(array("id", "class", "value", "checked", "required")), ' value="', $this->filter($value), '"'; +            echo '<input id="', $this->_attributes["id"], '-', $count, '"', $this->getattributes(array("id", "class", "value", "checked")), ' value="', $this->filter($value), '"';                         if(in_array($value, $this->_attributes["value"]))                                 echo ' checked="checked"';                         echo '/> ', $text, ' </label> '; 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -