Form

From Platform Documentation

Jump to: navigation, search

Introduction

The Form Library gives you access to all the XHTML form elements. In addition to preparing and presenting the form, the Form Library has an added security layer for use with an object's editor and inject functions. Generally speaking, forms are automatically created for you based on the object being modified. Apart from being able to call it directly for custom forms, this library is used internally by the object editor.

File ./library/form.class.php      ★      SVN http://svn.xombo.org/svn/platform/current/trunk/library/form.class.php API DOCS

Functions

Form::form ($name, $view, $method, $input)

Creates the initial form code, links it back to a view. You can pass all the form's inputs as an array to $input. If you don't pass $input, you must use ::endform () after all your elements have been manually passed.

Form::endform ()

Closes the form.

Form::action ($value, $options)

Creates a hidden “action” field that determines what your form's callback will be.

Form::hidden ($name, $value, $options)

Creates a hidden field.

Form::submit ($name, $value, $options)

Creates a submit button.

Form::button ($name, $value, $options)

Creates a button.

Form::text ($name, $value, $options)

Creates a simple text field.

Form::textarea ($name, $value, $options)

Creates a multi-line text field.

Form::password ($name, $value, $options)

Creates a hidden password text field.

Form::checkbox ($name, $value, $status, $options)

Creates a checkbox.

Form::radio ($name, $value, $status, $options)

Creates a radio button.

Form::select ($name, $values, $default, $options)

Creates a select drop-list. You can pass $values as an associative array and specify the default selected value with $default.

Form::upload ($formname, $inputname, $view, $callback, $input)

Creates a complete file upload form. You can specify the $view and $callback action for it to post data to. You can add additional input fields to $input as an array. This form will automatically close itself.
Retrieved from "http://docs.xombo.org/Form"