Comment on page
Forms
Please note: This page is under construction and has not been finished yet.
Use the following to retrieve the form class object
$frm = e107::getForm();
Returns a form opening tag.
$frm->open('myform');
$frm->open('myform', 'get', 'myscript.php', array('autocomplete' => 'on', 'class' => 'formclass'));
Parameter | Type | Description | Mandatory |
name | string | Name of the form | Yes |
mode | string | post | get
'post' by default | No |
target | string | The request URL
e_REQUEST_URI by default | No |
options | array | Specify options such as class or autocomplete
| No |
Returns a form closing tag
$frm->close();
Returns a text field form element
$frm->text('my-field', 'current_value', 100, array('size' => 'large')); // returns <input class="tbox input-large" id="my-field" maxlength="100" name="my-field" type="text" value="current_value"></input>
Parameter | Type | Description | Mandatory |
name | string | Name of the text field | |
value | string | Value of the text field | |
maxlength | integer | Specifies the maxlength element of the text field | |
options | array | Specify options such as class, size or selectize
| |
$frm->textarea($name, $value, $rows, $cols, $options, $counter);
$frm->bbarea($name, $value, $template, $mediaCat, $size, $options);
Parameter | Type | Description | Mandatory |
name | string | Name of the field | Yes |
value | string | Contents of the field | Yes |
template | string | A string defining the button template to use with bbarea. Included in the core are the following: news, submitnews, extended, admin, mailout, page, comment, signature
But you can also use the name of the plugin (e.g. forum) if the plugin provides a bbcode_template.php | No |
mediaCat | string | Name of the media catalog to use
(default: _common)
Is only used by TinyMCE plugin (if installed and used) | No |
size | string | Size of the bbarea/editor.
Use one of the following values: tiny, small, medium, large
(default: large) | No |
options | array | Array with options to use with the editor:
id: string - In case the bbarea/editor id should be different to the name
class: string - the css classes to use
counter: boolean - Show a character counter
wysiwyg: boolean/string -
| No |
$frm->select($name,$option_array,$selected,$options,$defaultBlank);
$frm->checkbox($name,$value,$checked,$options);
$frm->hidden($name,$value,$options);
$frm->button($name,$value,$action,$label,$options);
Render a Bootstrap carousel
$frm->carousel($name, $array, $options);
$array = array(
'slide1' => array('caption' => 'Slide 1', 'text' => 'first slide content' ),
'slide2' => array('caption' => 'Slide 2', 'text' => 'second slide content' ),
'slide3' => array('caption' => 'Slide 3', 'text' => 'third slide content' )
);
echo $frm->carousel('my-carousel', $array);
Render Bootstrap tabs
$frm->tabs($array,$options);
$array = array(
'home' => array('caption' => 'Home', 'text' => 'some tab content' ),
'other' => array('caption' => 'Other', 'text' => 'second tab content' )
);
echo $frm->tabs($array);
echo $frm->tabs($array, array('active' => 'other')); // make 'other' the initial active tab.
Date field with popup calendar. Returns UNIX timestamp or string value on submit.
$frm->datepicker($name, $datestamp = false, $options = null)
Parameter | Type | Description | Mandatory? |
name | string | The name of the field | Yes |
datestamp | integer|boolean | UNIX timestamp. Set the default value of the field. Default: false | No |
options | array|string |
Default: null | No |
TODO: Clarify possible options and add more examples
$frm->datepicker('my_field',time(),'mode=date');
$frm->datepicker('my_field',time(),'mode=datetime&inline=1');
$frm->datepicker('my_field',time(),'mode=date&format=yyyy-mm-dd');
$frm->datepicker('my_field',time(),'mode=datetime&format=MM, dd, yyyy hh:ii');
$frm->datepicker('my_field',time(),'mode=datetime&return=string');
Last modified 1yr ago