Server-side form validation

From Joomla! Documentation
(Difference between revisions)
Jump to: navigation, search
m (Validation rules: filling in descritpions "options")
m (Validation rules: spelling corrections)
(One intermediate revision by one user not shown)
Line 40: Line 40:
 
'''options'''
 
'''options'''
 
| Requires the value entered be one of the options in a field of type="list"
 
| Requires the value entered be one of the options in a field of type="list"
| Todo (e.g. {{JVer|1.5}} and newer)
+
| {{JVer|11.1}} and newer  
  
 
|-
 
|-
Line 51: Line 51:
 
|
 
|
 
'''tel'''
 
'''tel'''
| Todo
+
| Telephone number (nanpa, ITU-T T-REC-E.164 or ietf rfc4933)
| Todo (e.g. {{JVer|1.5}} and newer)
+
| {{JVer|11.1}} and newer
  
 
|-
 
|-

Revision as of 04:51, 21 September 2012

Note

Please note that the content on this page is currently incomplete. Please treat it as a work in progress.

This article was last edited by E-builds (talk| contribs) 7 months ago. (Purge)


After submitting a form, you should validate your data. In Joomla this can be done via the JForm validate method (normally called in the controller via the model JModelForm).

Unlike client-side validation, the validation uses html attributes to do its validation. There is the attribute required ("true" or "required") which makes a field required and the attribute validate with a joomla or custom rule value.

E.g. field in a joomla form xml

<field name="email" type="text" class="inputbox" description="Fill in your E-mail" label="E-mail" required="true" validate="email" size="30" />

Validation rules

Rule Description Availability

boolean

Todo Todo (e.g. Joomla 1.5 and newer)

color

Todo Todo (e.g. Joomla 1.5 and newer)

email

Todo Todo (e.g. Joomla 1.5 and newer)

equals

Todo Todo (e.g. Joomla 1.5 and newer)

options

Requires the value entered be one of the options in a field of type="list" Joomla 11.1 and newer

rules

Todo Todo (e.g. Joomla 1.5 and newer)

tel

Telephone number (nanpa, ITU-T T-REC-E.164 or ietf rfc4933) Joomla 11.1 and newer

url

Todo Todo (e.g. Joomla 1.5 and newer)

username

Todo Todo (e.g. Joomla 1.5 and newer)
Personal tools
Namespaces

Variants
Actions
Navigation
Joomla! Sites
Toolbox