|
|
|
|
|
|
CancelButton |
CancelButton (
string |
$caption = "Cancel", |
string |
$url = "javascript:history.back(1)", |
string |
$name = null, |
mixed |
$extra = null |
) |
Arguments:
Name |
Description |
$caption |
The caption of the button. The default caption is "Cancel", but this is language dependent. |
$url |
The url to go to when the cancel button is presed. By default, the browser will go to the previous page. |
$name |
Name of the button. A name is generated if none is given. |
$extra |
This can be extra information which will be included in the buttons html tag. You can add for example some CSS or javascript. |
Description:
Creates a cancel button. This is just like a normal button only when you press it you will go to the given page.
Example
<?php
// include the formhandler
include("FH3/class.FormHandler.php");
// create a new formhandler object
$form = new FormHandler("myForm");
// textfield
$form -> textField("Name", "name", FH_STRING);
// set a mask for some nice buttons row
$form -> setMask(
" <tr>\n".
" <td> </td>\n".
" <td> </td>\n".
" <td>%field% %field%</td>\n".
" </tr>\n"
);
// set button 1: a submit button
$form -> submitButton("Save");
// set button 2: the cancelbutton
// go to ../index.php when the button is pressed
$form -> cancelButton("Cancel", "../index.php");
// set the handler
$form -> onCorrect("doRun");
// flush it
$form -> flush();
// the handler...
function doRun( $data )
{
echo "Hello ". $data["name"];
}
?>
|
Preview image
Latest change: 05 March 10 / 08:42
Comments
|
|
|
|