pails/form_builder

There is no license information available for the latest version (v1.0.3) of this package.

v1.0.3 2016-05-20 21:38 UTC

This package is not auto-updated.

Last update: 2024-11-06 23:37:19 UTC


README

A utility that makes building a form ridiculously easy.

Dependencies

None

Installation

In the root of a pails app, run

pails install form_builder

Configuration

Inside any controller where you want to make use of the form builder, use the FormBuilder trait.

class DefaultController extends Pails\Controller
{
	use PailsAuthentication;
}

Then, in the relevant views, you can call $this->input_for()

string input_for(string data_name, string label, array options)

  • data_name - the name of the form element
  • label - the text that should accompany the form element
  • options - an array of options, depending on the type of element
    • type - (default: text) the type of input
      • list - select list, with options
      • textarea - a large textbox
      • radio - a set of radio buttons, with options
      • check - a set of checkboxes, with options
      • number - a number input type (with options, multiple)
      • text - a standard text input field
    • value - (default: empty string) the initial value of the element
    • tooltip - (default: empty string) the title attribute, provides additional information about the input
    • style - (default: empty string; textarea only) inline CSS styles
    • options - (default: array(); radio, check, list, and number only) an associative array of options. key is the input's value and the value is the text that should be displayed for that option
  • Returns: a string of HTML built with the corresponding options

Support

pails-form-builder is a core plugin supported by Synapse Software. Contact us at support@synapsesoftware.com.