Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Work in Progress

jQuery Validation Plugin

The standard formtool library leverages Jörn Zaefferer's jQuery Validation Plugin. The basic method is to attach to the form's onsubmit event, read out all the form elements' classes and perform validation if required. If a field fails validation, reveal field validation advice and prevent the form from submitting.

List of validation methods

  • required
  • email
  • url
  • date
  • number
  • digits
  • creditcard

Validate Content Types

Simple add ftValidation to your Formtool Property with a comma separated list of validation requirements.

Example

<cfcomponent name="superHero" extends="farcry.core.packages.types.types" output="false" displayname="Super Hero">

	<cfproperty
		name="title" type="string" hint="Super hero title." required="true"
		ftSeq="1" ftValidation="required" ftFieldset="General Details" ftWizardStep="Teaser Information" ftLabel="Title" />
	<cfproperty
		name="mailaddress" type="string" hint="His Email"
		ftSeq="2" ftValidation="required,email" ftFieldset="General Details" ftWizardStep="Teaser Information" ftLabel="Email Address" />
	<cfproperty
		name="homepage" type="string" hint="Homepage"
		ftSeq="3" ftValidation="url" ftFieldset="General Details" ftWizardStep="Teaser Information" ftLabel="Homepage" />
	<cfproperty
		name="nbrOfSiblings" type="integer" hint="Siblings" default="0"
		ftSeq="4" ftValidation="required,digits" ftFieldset="General Details" ftWizardStep="Teaser Information" ftLabel="Siblings"	/>

</cfcomponent>

Additional methods

There are additional methods like lettersonly or nowhitespace provided by the jQuery plugin which are not loaded by default.

You can register and load the javascript file when you want to use it.

<skin:registerJS 	id="jquery-validate-additional"
					baseHREF="#application.url.webtop#/thirdparty/jquery-validate"
					lFiles="additional-methods.js"
					bCombine="false" /> <!--- Combine doesn't work. Seems to have a problem with the regex.  --->

--------------
<skin:loadJS id="jquery-validate-additional" />

Open core/webtop/thirdparty/jquery-validate/additional-methods.js to see all documented validation functions.

  • No labels