Skip to content

Instantly share code, notes, and snippets.

@mhenke
Created August 20, 2010 13:01
Show Gist options
  • Save mhenke/540248 to your computer and use it in GitHub Desktop.
Save mhenke/540248 to your computer and use it in GitHub Desktop.
<h1>Editing entry</h1>
<cfoutput>
#errorMessagesFor("entry")#
#startFormTag(action="update", key=params.key)#
#textField(objectName='entry', property='userID', label='User I D')#
#textField(objectName='entry', property='categoryID', label='Category I D')#
#textField(objectName='entry', property='title', label='Title')#
#textField(objectName='entry', property='body', label='Body')#
#dateTimeSelect(objectName='entry', property='dateCreated', dateOrder='year,month,day', monthDisplay='abbreviations', label='Date Created')#
#dateTimeSelect(objectName='entry', property='dateLastUpdated', dateOrder='year,month,day', monthDisplay='abbreviations', label='Date Last Updated')#
#submitTag()#
#endFormTag()#
#linkTo(text="Return to the listing", action="index")#
</cfoutput>
<cfcomponent extends="Controller" output="false">
# ...
<cffunction name="show">
<!--- Find the record --->
<cfset entry = model("Entry").findByKey(params.key)>
# ...
</cffunction>
<cffunction name="edit">
<!--- Find the record --->
<cfset entry = model("Entry").findByKey(params.key)>
# ...
</cffunction>
<cffunction name="update">
<cfset entry = model("Entry").findByKey(params.key)>
# ...
</cffunction>
<cffunction name="delete">
<cfset entry = model("Entry").findByKey(params.key)>
# ...
</cffunction>
</cfcomponent>
<h1>Create new entry</h1>
<cfoutput>
#errorMessagesFor("entry")#
#startFormTag(action="create")#
#textField(objectName='entry', property='userID', label='User I D')#
#textField(objectName='entry', property='categoryID', label='Category I D')#
#textField(objectName='entry', property='title', label='Title')#
#textField(objectName='entry', property='body', label='Body')#
#dateTimeSelect(objectName='entry', property='dateCreated', dateOrder='year,month,day', monthDisplay='abbreviations', label='Date Created')#
#dateTimeSelect(objectName='entry', property='dateLastUpdated', dateOrder='year,month,day', monthDisplay='abbreviations', label='Date Last Updated')#
#submitTag()#
#endFormTag()#
#linkTo(text="Return to the listing", action="index")#
</cfoutput>
@mhenke
Copy link
Author

mhenke commented Aug 20, 2010

Thanks, I'll add your justification to the article. Maybe you want to add that to the description so people if curious why all the duplication. They will understand why this isn't meant to be a final completely polished code generator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment