Skip to content

Miscellaneous

passwordField()

passwordField() — returns any

Builds and returns a string containing a password field form control based on the supplied objectName and property. Note: Pass any additional arguments like class, rel, and id, and the generated tag will also include those values as HTML attributes.

NameTypeRequiredDefaultDescription
objectNameanyyes—See documentation for textField.
propertystringyes—See documentation for textField.
associationstringyes—See documentation for textfield.
positionstringyes—See documentation for textfield.
labelstringyesuseDefaultLabelSee documentation for textField
labelPlacementstringyesaroundSee documentation for textField.
prependstringyes—See documentation for textField.
appendstringyes—See documentation for textField.
prependToLabelstringyes—See documentation for textField.
appendToLabelstringyes—See documentation for textField.
errorElementstringyesspanSee documentation for textField.
errorClassstringyesfieldWithErrorsSee documentation for textField.
<!--- Provide a `label` and the required `objectName` and `property` --->
<cfoutput>
    #passwordField(label="Password", objectName="user", property="password")#
</cfoutput>

<!--- Display fields for passwords provided by the `passwords` association and nested properties --->
<fieldset>
	<legend>Passwords</legend>
	<cfloop from="1" to="##ArrayLen(user.passwords)##" index="i">
		#passwordField(label="Password ####i##", objectName="user", association="passwords", position=i, property="password")#
	</cfloop>
</fieldset>