Login Retreive lost passwordRegister
Search

Manual  /  Functions  /  Fields  /  BrowserField

(Since version FH3 v1.2.2)

BrowserField
BrowserField (
string $title
string $name
string $path
mixed $validator = null,
integer $size = 20,
string $extra = null 
)

Arguments:

Name Description
$title Title of the field
$name Name of the field
$path The path where images can be browsed and uploaded
$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 The size of the field.
$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:

Creates a textfield with a browse button which invokes the FCK filemanager to insert a filename

Example

<?php

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

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

// make the browser field
$form->BrowserField('Image','image'"/uploads/Image");

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

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

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

// the function witch handles the code after the form
function doRun$data )
{
    
// show the data
    
return $data["image"];
}

?>

Preview image

preview image

See also: TextField

Latest change: 11 July 11 / 09:26

Comments

Johan Wiegel 26 June 08 / 19:46  
In order to let a user delete files in the BrowserField

Make sure this function is protected before removing the die in the FHTML/FCKEditor/filemanager/connectors/php/delete.php

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