FormsPlus

Summary: Form extensions adding new HTML5 input types
Version: 2017-06-16a
Prerequisites: PmWiki 2.2.56 (compatible with PHP 5.5)
Status: new updated
Maintainer: HansB
Categories: Forms HTML5 PHP55 PHP72
Users: (view? / edit)
Discussion: FormsPlus-Talk
Download: formsplus.phpΔ

Description

Form markup extensions adding new input types 'date', 'datetime', 'datetime-local', 'time', 'week', 'month', 'number', 'email', 'url', 'tel', 'search', 'color', 'range', as well as 'frame' = 'fieldset', 'frameend' = 'fieldsetend', 'label'.

Installation

Download formsplus.phpΔ, copy to cookbook folder, and add to config.php:

include_once("$FarmD/cookbook/formsplus.php");

Configuration

No further configuration required. New form input markup types are now available.

Usage

Use new input types like the default PmWiki input types within the (:input ...:) markup.

Example:
(:input form id="dummy" action="" method="post":)
(:input frame legend="Sample form with new HTML5 controls":)
(:input label date1 "date:":) 
(:input date  id="date1" name="date1" value="{(ftime %F now)}":) 
(:input label time1 "time:":) 
(:input time id="time1" name="time1" value="{(ftime %H:%M now)}":)

(:input label email1 "email:":)
(:input email id="email1" name="email1" value="name@example.org":)
(:input label url1 "url:":)
(:input url id="url1" name="url1" value="http://example.org/":)
(:input label tel1 "tel:":)
(:input tel id="tel1" name="tel1" value="0123456789":)

(:input label number1 "number:":) 
(:input number id="number1" name="number1" value="123":)
(:input label range1 "range:":)
(:input range id="range1" value="50" min="0" max="100" step="1" :)
(:input label color1 "color:":)
(:input color id="color1" name="color1" value="#abcdef":)

(:input submit value="Submit":)
(:input reset value="Reset":)
(:input frameend:)
(:input end:)

Notes

'frame' (='fieldset') and 'label' is widely supported.
All others are new and browser support is sketchy, only Opera supports these new types fully. Other browsers revert to use the new types as standard text input boxes. In time new browser versions will offer custom rendered controls, like Opera's calender date selector, and its color selector.

Change log / Release notes

  • 2017-06-16: changed Markup_e() to Markup().
  • 2015-07-18: Minor refactor ( no more PSS function )
  • 2015-07-14: Compatibility with PHP 5.5 fixed. Works also for older version without the Markup_e fonction.
  • 2014-02-21: updated markup definition for PHP 5.5 compatibility.
  • 2011-02-22: initial release

If the recipe has multiple releases, then release notes can be placed here. Note that it's often easier for people to work with "release dates" instead of "version numbers".

See also

  • Forms - General info about input markup
  • FormExtensions - recipe to add fieldset and label markup for use in forms.

Contributors

  • AntonyTemplier

Comments

See discussion at FormsPlus-Talk

User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.