This plugin provides HTML form capabilities for other plugins. This allows for consistent form tags and behaviors, while reducing overall plugin size and development time.
This plugin is licensed under the GPLv2.
- mem_form
- mem_form_checkbox
- mem_form_email
- mem_form_file
- mem_form_hidden
- mem_form_radio
- mem_form_secret
- mem_form_select
- mem_form_select_category
- mem_form_select_range
- mem_form_select_section
- mem_form_serverinfo
- mem_form_submit
- mem_form_text
- mem_form_textarea
- mem_form_value
This tag will create an HTML form and contains all of the processing and validation.
- form string Name of a form that will be parsed to display the form.
- thanks_form string Name of a form that will be parsed upon successful form submission.
- label string Accessible name for the form.
- type string Name of the form to identify itself to bound plugin.
- thanks string Message to display to user upon successful form submission.
- redirect url URL to redirect upon successful form submission. Overrides “thanks” and “thanks_form”.
- redirect_form string Name of a form that will be parsed as displayed to the user on a redirect. The string “_{uri}_” will be replaced with the redirect url.
- enctype string HTML encoding type used when the form is submitted.
enctype="multipart/form-data"
is required when using mem_form_file. - default_break string Separator between label tag and input tag to be used as the default for every mem_form compatible field contained in the form. Default is
<br>
This will output an HTML checkbox field.
- break string Separator between label tag and input tag.
- checked int Is this box checked. Default “0”.
- label string Friendly name for the input field. If set, this will output an HTML
<label>
tag linked to the input field. - name string Input field name.
- required int Specifies if input is required.
- class string CSS class name.
This will output an HTML text input field and validates the submitted value as an email address.
- break string Separator between label tag and input tag.
- label string Friendly name for the input field. If set, this will output an HTML
<label>
tag linked to the input field. - name string Input field name.
- required int Specifies if input is required.
- class string CSS class name.
- default string The default value.
- max int Max character length.
- min int Min character length.
- size int Size of input field.
+p(tag-summary). This will output an HTML file input field. You must add the enctype="multipart/form-data"
attribute to your enclosing mem_form for this to work.
- label string Friendly name for the input field. If set, this will output an HTML
<label>
tag linked to the input field. - name string Input field name.
- class string CSS class name.
- break string Separator between label tag and input tag.
- no_replace int Specifies whether a user can upload another file and replace the existing file that will be submitted on successful completion of the form. If “1”, the file input field will be replaced with details about the already uploaded file.
- required int Specifies if input is required.
- size int Size of input field.
- max_file_size int Maximum size for the uploaded file. Checked server-side.
- accept string The HTML file input field’s “accept” argument that specifies which file types the field should permit.
mem_form_hidden
This will output an HTML hidden text input field.
- label string Friendly name for the input field. If set, this will output an HTML
<label>
tag linked to the input field. - name string Input field name.
- value string The input value.
- required int Specifies if input is required.
- class string CSS class name.
- escape_value int Set to “0” to prevent html escaping the value. Default “1”.
This will output an HTML radio button.
- break string Separator between label tag and input tag.
- label string Friendly name for the input field. If set, this will output an HTML
<label>
tag linked to the input field. - name string Input field name.
- class string CSS class name.
- group string A name that identifies a group of radio buttons.
- value string The value of the radio button. If not set, a unique value is generated.
- checked int Is this box checked. Default “0”.
This will output nothing in HTML and is meant to pass information to the sumbit handler plugins.
- label string Friendly name for the input field. If set, this will output an HTML
<label>
tag linked to the input field. - name string Input field name.
- value string The input value.
This will output an HTML select field.
- label string Friendly name for the input field. If set, this will output an HTML
<label>
tag linked to the input field. - name string Input field name.
- break string Separator between label tag and input tag.
- delimiter string List separator. Default “,”
- items string Delimited list containing a select list display values.
- values string Delimited list containing a select list item values.
- required int Specifies if input is required.
- selected string The value of the selected item.
- first string Display value of the first item in the list. E.g. “Select a Section” or “” for a blank option.
- class string CSS class name.
- select_limit int Specifies the maximum number of items that may be selected. If set to a value greater than 1, a multiselect will be used. The stored value will be an array.
- as_csv int If set to 1, the value will be stored as a delimited string of values instead of an array. This does nothing when select_limit is less than 2.
This will output an HTML select field populated with the specified Textpattern categories.
- label string Friendly name for the input field. If set, this will output an HTML
<label>
tag linked to the input field. - name string Input field name.
- break string Separator between label tag and input tag.
- delimiter string List separator. Default “,”
- items string Delimited list containing a select list display values.
- values string Delimited list containing a select list item values.
- required int Specifies if input is required.
- selected string The value of the selected item.
- first string Display value of the first item in the list. E.g. “Select a Section” or “” for a blank option.
- class string CSS class name.
- exclude string List of item values that will not be included.
- sort string How will the list values be sorted.
- type string Category type name. E.g. “article”
h3(tag#mem_form_select_range) . mem_form_select_range
This will output an HTML select field populated with a range of numbers.
- start int The initial number to include. Default is 0.
- stop int The largest/smallest number to include.
- step int The increment between numbers in the range. Default is 1.
- label string Friendly name for the input field. If set, this will output an HTML
<label>
tag linked to the input field. - name string Input field name.
- break string Separator between label tag and input tag.
- delimiter string List separator. Default “,”
- items string Delimited list containing a select list display values.
- values string Delimited list containing a select list item values.
- required int Specifies if input is required.
- selected string The value of the selected item.
- first string Display value of the first item in the list. E.g. “Select a Section” or “” for a blank option.
- class string CSS class name.
- exclude string List of item values that will not be included.
- sort string How will the list values be sorted.
- type string Category type name. E.g. “article”
This will output an HTML select field populated with the specified Textpattern sections.
- label string Friendly name for the input field. If set, this will output an HTML
<label>
tag linked to the input field. - name string Input field name.
- break string Separator between label tag and input tag.
- delimiter string List separator. Default “,”
- items string Delimited list containing a select list display values.
- values string Delimited list containing a select list item values.
- required int Specifies if input is required.
- selected string The value of the selected item.
- first string Display value of the first item in the list. E.g. “Select a Section” or “” for a blank option.
- class string CSS class name.
- exclude string List of item values that will not be included.
- sort string How will the list values be sorted.
This will output no HTML and is used to pass server information to the plugin handling the form submission.
- label string Friendly name for the input field. If set, this will output an HTML
<label>
tag linked to the input field. - name string Input field name.
This will output either an HTML submit input field or an HTML button.
- label string Friendly name for the input field. If set, this will output an HTML
<label>
tag linked to the input field. - name string Input field name.
- class string CSS class name.
- button int If “1”, an html button tag will be used instead of an input tag.
This will output an HTML text input field.
- label string Friendly name for the input field. If set, this will output an HTML
<label>
tag linked to the input field. - name string Input field name.
- class string CSS class name.
- break string Separator between label tag and input tag.
- default string The default value.
- format string A regex pattern that will be matched against the input value. You must escape all backslashes ‘\’. E.g “/\\d/” is a single digit.
- example string An example of a correctly formatted input value.
- password int Specifies if the input field is a password field.
- required int Specifies if input is required.
- max int Max character length.
- min int Min character length.
- size int Size of input field.
- escape_value int Set to “0” to prevent html escaping the value. Default “1”.
This will output an HTML textarea.
- label string Friendly name for the input field. If set, this will output an HTML
<label>
tag linked to the input field. - name string Input field name.
- class string CSS class name.
- break string Separator between label tag and input tag.
- default string The default value.
- max int Max character length.
- min int Min character length.
- required int Specifies if input is required.
- rows int Number of rows in the textarea.
- cols int Number of columns in the textarea.
- escape_value int Set to “0” to prevent html escaping the value. Default “1”.
This will output the value associated with a form field. Useful to mix HTML input fields with mem_form.
- id string ID for output wrap tag.
- class string CSS class name.
- class string CSS class.
- wraptag string HTML tag to wrap around the value.
- attributes string Additional HTML tag attributes that should be passed to the output tag.
This will send an email message.
- Return Value bool Returns true or false, indicating whether the email was successfully given to the mail system. This does not indicate the validity of the email address or that the recipient actually received the email.
- from string The From email address.
- reply string The Reply To email address.
- to string The To email address(es).
- subject string The email’s Subject.
- msg string The email message.
This will set or get errors associated with the form.
- Return Value mixed If err is NULL, then it will return an array of errors that have been set.
- err string An error that will be added to the list of form errors that will be displayed to the form user.
This will get or set a default value for a form.
- Return Value mixed If val is NULL, then it will return the default value set for the input field matching %(atts-name)key. If key does not exist, then it will return FALSE.
- key string The name of the input field.
- val string If specified, this will be specified as the default value for the input field named “key”.
This will store the name, label and value for a field in to the appropriate global variables.
- name string The name of the field.
- label string The label of the field.
- value mixed The value of the field.
This will remove the information associated with a field that has been stored.
- name string The name of the field.
This library allows other plugins to hook in to events with the register_callback
function.
- $mem_form_type string A text value that allows a plugin determine if it should process the current form.
- $mem_form_submit bool This specifies if the form is doing a postback.
- $mem_form_default array An array containing the default values to use when displaying the form.
- $mem_form array An array mapping all input labels to their values.
- $mem_form_labels array An array mapping all input names to their labels.
- $mem_form_values array An array mapping all input names to their values.
- $mem_form_thanks_form string Contains the message that will be shown to the user after a successful submission. Either the “thanks_form” or the “thanks” attribute. A plugin can modify this value or return a string to over
Allows a plugin to alter the default values for a form prior to being displayed.
Allows a plugin to insert additional html in the rendered html form tag.
Allows a plugin to act upon a successful form submission.
Allows a plugin to test a submission as spam. The function get_mem_form_evaluator() returns the evaluator.
On submit, this event is called for each field that passed the builtin checks and was just stored in to the global variables. The callback step is the field name. This callback can be used for custom field validation. If the value is invalid, return FALSE. Warning: This event is called for each field even if a previously checked field has failed.
This event is called on form submit, after the individual fields are parsed and validated. This event is not called if there are any errors after the fields are validated. Any multi-field or form specific validation should happen here. Use mem_form_error() to set any validation error messages to prevent a successful post.