Input Validation

(:foxdisplay:) (:rater 1 'these examples':)

Input validation examples for Fox forms

Example 1

(:foxdisplay:)
(:foxmessages frm list=nocheck:)
(:fox frm foxaction=display :)
(:foxtemplate "Name: {$$var1}\nPhone: {$$var2}\nAnswer: {$$var3}":)
(:input default request=1:)
(:foxcheck var1 msg="Please enter your name!":)
Name: (:input text var1:) %red%(:foxmessage frm var1:)\\
(:foxcheck var2 regex='^[0-9\-]+$' msg="Please enter your phone number!":)
Telefon: (:input text var2:) %red%(:foxmessage frm var2:)\\
(:foxcheck match='56' var3 msg="Wrong answer! Please try again!":)
7 * 8 = (:input text var3:) %red%(:foxmessage frm var3:)\\
(:input submit post Enter:)
(:foxend frm:)

(:foxdisplay:) (:foxmessages frm list=nocheck:) (:fox frm foxaction=display :) (:foxtemplate "Name: {$$var1}\nPhone: {$$var2}\nAnswer: {$$var3}":) (:foxcheck var1 msg="Please enter your name!":) Name: (:foxmessage frm var1:)
(:foxcheck var2 regex='^[0-9\-]+$' msg="Please enter your phone number!":)
Telefon: (:foxmessage frm var2:)
(:foxcheck match='56' var3 msg="Wrong answer! Please try again!":)
7 * 8 = (:foxmessage frm var3:)
(:foxend frm:)

Example 2

%red%(:foxmessage form1 ptvupdate=1 list=nocheck:)
(:fox form1 template=Site.FoxTemplates#example :)
(:foxcheck target match='Test*' msg="pagename needs to begin with: Test":)
(:foxcheck date regex='[12]\d\d\d-(0\d|1[0-2])-([0-2]\d|3[01])' msg='please enter date as YYYY-MM-DD':) 
(:foxcheck time regex='([0-1]\d|2[0-3]):[0-5]\d' msg='enter time as HH:MM using 24 hour format':)  
(:foxcheck author msg='please sign as author!':) 
Page: (:input text target:) %red%(:foxmessage form1 target:)%%\\
Date: (:input text date:) %red%(:foxmessage form1 date:)%%\\
Time: (:input text time:) %red%(:foxmessage form1 time:)%%\\
Author: (:input text author:) %red%(:foxmessage form1 author:)%%\\
(:input submit post Enter:)
(:foxend form1:)

(:foxmessage form1 ptvupdate=1 list=nocheck:) (:fox form1 template=Site.FoxTemplates#example :) (:foxcheck target match='Test*' msg="pagename needs to begin with: Test":) (:foxcheck date regex='[12]\d\d\d-(0\d|1[0-2])-([0-2]\d|3[01])' msg='please enter date as YYYY-MM-DD':) (:foxcheck time regex='([0-1]\d|2[0-3]):[0-5]\d' msg='enter time as HH:MM using 24 hour format':) (:foxcheck author msg='please sign as author!':) Page: (:foxmessage form1 target:)
Date: (:foxmessage form1 date:)
Time: (:foxmessage form1 time:)
Author: (:foxmessage form1 author:)
(:foxend form1:)


<< | TestPages | >>