Last active
December 16, 2015 16:54
-
-
Save chrisdpeters/ba9a265ba360eb88ce11 to your computer and use it in GitHub Desktop.
Hiding complex model relationships behind form objects in CFWheels
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfoutput> | |
<fieldset> | |
<legend>User</legend> | |
#textField(objectName="userForm", property="firstName")# | |
#errorMessageOn(objectName="userForm", property="firstName")# | |
#textField(objectName="userForm", property="lastName")# | |
#errorMessageOn(objectName="userForm", property="lastName")# | |
#textField(objectName="userForm", property="emailAddress")# | |
#errorMessageOn(objectName="userForm", property="emailAddress")# | |
</fieldset> | |
<fieldset> | |
<legend>Login Credentials</legend> | |
#textField(objectName="userForm", property="username")# | |
#errorMessageOn(objectName="userForm", property="username")# | |
#passwordField( | |
objectName="userForm", | |
property="password", | |
required=userForm.isNew(), | |
append=(userForm.isNew() ? "" : ' <label for="userForm-password" class="quiet example">Leave blank to keep the same</label>') | |
& get(functionName="passwordField", name="append") | |
)# | |
#errorMessageOn(objectName="userForm", property="password")# | |
#passwordField( | |
objectName="userForm", | |
property="passwordConfirmation", | |
required=userForm.isNew(), | |
append=(userForm.isNew() ? "" : ' <label for="userForm-passwordConfirmation" class="quiet example">Leave blank to keep the same</label>') | |
& get(functionName="passwordField", name="append") | |
)# | |
#errorMessageOn(objectName="userForm", property="passwordConfirmation")# | |
</fieldset> | |
<fieldset> | |
<legend>Permissions</legend> | |
#select(objectName="userForm", property="roleId", options=roles, required=true)# | |
#errorMessageOn(objectName="userForm", property="roleId")# | |
#select(objectName="userForm", property="vendorId", options=vendors, includeBlank="-- None --")# | |
#errorMessageOn(objectName="userForm", property="vendorId")# | |
#textField(objectName="userForm", property="afterHoursAccessStart", class="datepicker")# | |
#errorMessageOn(objectName="userForm", property="afterHoursAccessStart")# | |
#textField(objectName="userForm", property="afterHoursAccessUntil", class="datepicker")# | |
#errorMessageOn(objectName="userForm", property="afterHoursAccessUntil")# | |
<cfif not userForm.isNew()> | |
#checkBox(objectName="userForm", property="reactivateUser")# | |
#errorMessageOn(objectName="userForm", property="reactivateUser")# | |
</cfif> | |
#checkBox(objectName="userForm", property="isActive", required=false)# | |
#errorMessageOn(objectName="userForm", property="isActive")# | |
</fieldset> | |
</cfoutput> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfcomponent extends="Model"> | |
<cffunction name="init"> | |
<cfset table(false)> | |
</cffunction> | |
</cfcomponent> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment