Input Validation

Example using formcheck=... and (:foxcheck ... :)

Name:
Phone:

7 * 8 =

See also Fox Validation Examples

Fox has two levels for input checking, simple client-side javascript and server-side php. You can use both methods in the same form.
Simple client-side check using javascript :

(:fox formname ... formcheck=name1,name2..:)
a simple client-side (instant) java script check to alert if a named input field is left empty. This is only effective if user has a javascript enabled browser.

More reliable and detailed server side validation using php:

(:foxcheck name [match='STRING'] [regex='PATTERN']
  [if='CONDITION'] [msg='ERROR MSG']:)
PHP input validation check on input from field name. You can also use a list of names; name1,name2,.. etc.

Parameters:

(:foxmessage [formname] [name] [list=nocheck]:)
Markup to display Fox error and success messages. Output is inline text and can by styled with wiki markup, for instance like %red%'''(:foxmessage:)''' giving a red bold message.

Usage:

(:if foxerror <formname> <fieldname>:) conditional

The foxerror conditional is set true if an input validation error occurs as per setting of (:foxcheck ....:) markup. Either use conditional without <formname> and <fieldname> in a general way, or specify the fox form name and a specific input field name, to set a condition for trapping field specific input errors. In this way one could bypass the use of (:foxmessage ...:) and msg='...' within the (:foxcheck ... :) markup.


<< File Upload | Index | Page Variables >>