|
|
|
|
|
|
EnableViewMode |
EnableViewMode (
) |
Arguments:
Name |
Description |
$mode |
The mode. Should all fields set the "View Mode"? |
Description:
This function enables the view mode for all fields. All the fields are removed from the from and their values are displayed instead.
Example
<?php
// include the class
include('FH3/class.dbFormHandler.php');
// create new dbFormHandler object
$form = new dbFormHandler();
// set the database info
$form -> dbInfo( 'myDatabase', 'myTable' );
$form -> dbConnect( 'localhost', 'myUsername', 'myPassword' );
// on edit mode, just display the data
if( $form -> edit )
{
$form -> enableViewMode();
}
// the fields
$form -> textField( 'Name', 'Name', FH_STRING );
$form -> textField( 'Age', 'Age', FH_DIGIT );
// button to submit the form
$form -> submitButton();
// what to do when the form is saved
$form -> onSaved('showMessage');
// display the form
$form -> flush();
// the function which is runned when the form is saved
function showMessage( $id, $data )
{
echo
"Hello ". $data['Name'] ."\n".
"Your data is saved with id ". $id."\n";
}
?>
|
Preview image
See also: IsViewMode | SetFieldViewMode | IsFieldViewMode
Latest change: 05 March 10 / 08:49
Comments
|
|
|
|