CFWheels plugin for adding a marked-up asterisk next to required fields.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

CFWheels Required Fields Plugin

Use this plugin to append a marked up asterisk to the labels of required fields.

By default the added markup looks like this:

<span class="required">*</span>


The plugin will look at validations set on the object form helpers' properties to determine whether or not a validatesPresenceOf validation is set (manually or automatically).

You can override this by behavior when calling the form helper as well. Just set the required argument to true or false in the call to the form helper:

<!--- Force `name` field to required --->
#textField(objectName="category", property="name", required=true)#

<!--- Force `slug` field to appear as optional --->
#textField(objectName="category", property="slug", required=false)#

You can also use this plugin with the form tag functions by manually adding the required argument.

<!--- The "Tag" form helpers always need the `required` argument --->
#textFieldTag(name="Search",, required=true)#


You can modify some minor details of the required field indicator that appears. (By default, it is an asterisk.)

Just set the following variables in config/settings.cfm to override.

Setting Type Default Description
application.requiredFields.containerElement string span Container element around required field indicator.
application.requiredFields.containerClass string required Class set on container element around required field indicator.
application.requiredFields.indicatorText string * Required field indicator.


This plugin was created by Chris Peters with support from Liquifusion Studios. Thanks to James Gibson for technical advice and Troy Murray for assistance with CFWheels compatibility testing.

To submit an issue or fork this plugin, visit the liquifusion/cfwheels-required-fields repository on GitHub.


The MIT License (MIT)

Copyright (c) 2011-2016 Liquifusion Studios