Actions

Difference between revisions of "Server-side form validation"

From Joomla! Documentation

(My contribution, I hope someone else will fill in the description and availability)
 
m (Validation rules: filling in descritpions "options")
Line 39: Line 39:
 
|
 
|
 
'''options'''
 
'''options'''
| Todo
+
| Requires the value entered be one of the options in a field of type="list"
 
| Todo (e.g. {{JVer|1.5}} and newer)
 
| Todo (e.g. {{JVer|1.5}} and newer)
  

Revision as of 04:47, 21 September 2012

Quill icon.png
Content is Incomplete

This article or section is incomplete, which means it may be lacking information. You are welcome to assist in its completion by editing it as well. If this article or section has not been edited in several days, please consider helping complete the content.
This article was last edited by E-builds (talk| contribs) 21 months ago. (Purge)

Copyedit.png
This Article Needs Your Help

This article is tagged because it NEEDS REVIEW. You can help the Joomla! Documentation Wiki by contributing to it.
More pages that need help similar to this one are here. NOTE-If you feel the need is satistified, please remove this notice.


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" Todo (e.g. Joomla 1.5 and newer)

rules

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

tel

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

url

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

username

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