input type=checkbox, checkbox checked unchecked selected

inputCheckbox

A simple checkbox, like this: .
You can specify values for the unchecked and checked checkboxes. These values will be returned by $clonefish->getElementValues().

Note: according to the HTML specification, the unchecked checkbox values are missing when forms are submitted. Clonefish fixes this behaviour by design, so a checkbox value received from Clonefish is immediately insertable into a database for example.


<?php

$config 
= Array(
  
'answer' => Array(
    
'type'           => 'inputCheckbox',
    
'displayname'    => 'Please do check this checkbox!',
    
'onvalue'        => 1// value returned for a checked checkbox
    
'offvalue'       => 0// value returned for an unchecked checkbox
    
'value'          => 0// the value of 'onvalue' or 'offvalue'

    
'html'           => 'class="inputfieldstyle"',
    
'help'           => 'validation failed for this element',
    
'rowlayout'      => '...%element% %prefix% %postfix% etc...',
    
'prefix'         => 'string to display before element',
    
'postfix'        => 'string to display after element',
    
'readonly'       => 0,
    
'display'        => 0,
    
'htmlid'         => 'name1',
  )
);

?>


Live examples:

Validators to use together with this element:

form validation for developers!

clonefish is a proven, mature form generator class that helps PHP developers to create, validate and process secure, flexible and easy-to-maintain forms
learn more
Bookmark and Share