Line 23: | Line 23: | ||
''TODO: Above needs more details''<syntaxhighlight lang="html"> | ''TODO: Above needs more details''<syntaxhighlight lang="html"> | ||
− | < | + | <input type="number" name="Number" /> |
... | ... | ||
− | < | + | <input type="hidden" name="Number with prefix" value="nr. [Number]" parsepost /> |
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 15:59, 29 February 2024
Name
input
Type
input
Synopsis
Create various input fields
Description
input is like input in HTML, but can differ sometimes.
Parameters
All valid HTML attributes can be used, like :
name, value, class, placeholder, required etc..
For possible types you can search the FlexForm docs for all documentation that starts with input.
Some examples for types are : text, url, phone, textarea, password, range, checkboxes, radiobutton, email and more.
There are some FlexForm specific attributes like parsepost and html.
- parsepost can be used on e.g. a hidden field where the value holds names of other fields to be switched at post processing. e.g.
This will read the form field value with name "title" and replace [title] in the value of the newtitle field
TODO: Above needs more details
<input type="number" name="Number" />
...
<input type="hidden" name="Number with prefix" value="nr. [Number]" parsepost />
- html attribute allows filtering input fields. The options are :
- "default" which is the same as not adding it at all. It will filter by the HTMLPurifier rules (see link below)
- "all" no filtering will be done (not even XSS hacks)
- "nohtml" means all HTML will be filtered out
- "custom" is used like this : "custom=b,u,i", meaning no html is allowed, except bold, italic and underline
- tempex attribute in FlexForm is a custom attribute. This is in its beta status and is being tested and tweaked.
Tempex stands for Template Execute. You can add this attribute to e.g. a text field, textarea, number field, etc.. The value of that field will be determent by the result of an executed/parsed template.
The value for tempex starts with the name of the template, followed by the field names in your form, all devided by a pipe. Those fields will be monitored for changes and when a change is detected the template is parsed and the result will be inserted into the field that has the tempex argument. Example :
<form action="get" class="simple">
<label for="fname">First name</label> <input type="text" id="fname" name="First name" /><BR>
<label for="lname">Last name</label><input type="text" id="lname" name="Last name" /><br>
<label for="email">email address</label> <input type="email" id="email" name="email" /><br>
<textarea size="150" name="total" class="tital" tempex="TestingTempex|First name|Last name|email" />
<input type="submit" value="getsend" />
</form>
Of course there should be a Template:TestingTempex in your wiki in this example.
- required attribute in FlexForm differs from the HTML variant.
When a HTML5 form field has the word "required" as an attribute, this field will always be required. Even required="no" will make the field required.
With FlexForm this needs to be required="required" for an input field to be required. Only required or required="no" or required="whatever" will not make the field a required field.
Example on how to use required in FlexForm :
<input type="email" name="emailfield" placeholder="This is a placeholder" required="required" />