Form validation: Difference between revisions

From Joomla! Documentation

MATsxm (talk | contribs)
Marked this version for translation
No edit summary
Line 15: Line 15:
<translate><!--T:6-->
<translate><!--T:6-->
.. is done after having submitted the form and will normally return to the form when not validated with some extra messages. <br/>
.. is done after having submitted the form and will normally return to the form when not validated with some extra messages. <br/>
It used the HTML '''attributes''' <u>required</u> ("true" or "required") and <u>validate</u> (with value being a joomla or custom rule; e.g. validate="email")</translate>
It uses the HTML '''attributes''' <u>required</u> ("true" or "required") and <u>validate</u> (with value being a joomla or custom rule; e.g. validate="email")</translate>


<translate><!--T:7-->
<translate><!--T:7-->

Revision as of 11:16, 24 July 2015

Joomla has client-side and server-side form validation capabilities.
Server side validation is the minimum since everything before that can be overridden on the user side. But client-side is the most user-friendly one, so using both is not a bad idea (especially since the latter is unobtrusive and won't give problems on javascript-disabled or -problematic client browsers).

Client-side validation

.. is done via javascript while the user is filling in the form fields.
It uses the HTML classes required and validate-[xxx] (with [xxx] being a joomla or custom rule; e.g. validate-numeric)

More here: Client-side form validation

Server-side validation

.. is done after having submitted the form and will normally return to the form when not validated with some extra messages.
It uses the HTML attributes required ("true" or "required") and validate (with value being a joomla or custom rule; e.g. validate="email")

More here: Server-side form validation