Login Retreive lost passwordRegister
Search

Manual  /  Functions  /  Fields  /  ColorPicker

(Since version FH3 v1.2.5)

ColorPicker
ColorPicker (
string $title
string $name
mixed $validator = null,
integer $size = 20,
integer $maxlength = null,
string $extra = null 
)

Arguments:

Name Description
$title Title of the field
$name Name of the field
$validator This can either be the name of your own validation function or the constant name of a predefined validator function. For more information about validators see Validators.
It is also possible to use a method as a validation function. In this case you should pass an array where the first item is the object and the second item the name of the method.
$size size The size of the field.
$maxlength The maximum allowed characters in this field. 0 is interpretated as no limit.
$extra This can be extra information which will be included in the fields html tag. You can add for example some CSS or javascript.

Description:

This function will create a colorpicker on the form.

Example

<?php 

// include the class 
include('FH3/class.FormHandler.php'); 

// make a new $form object 
$form = new FormHandler(); 

// a ColorPicker 
$form->colorpicker("Color""color"); 

// submitbutton beneath it 
$form->submitButton("Save"); 

// set the 'commit after form' function 
$form->onCorrect("doRun"); 

// send the form to the screen 
$form->flush(); 

// function to show a message 
function doRun($data)  

    return 
"You picked this color code"$data["color"]; 

?>

Preview image

preview image

Latest change: 11 July 11 / 09:26

Comments

powered by PHP-GLOBE   © 2004 - 2024 FormHandler. All rights reserved.   -   Open source license