Warning | ||
---|---|---|
| ||
Updating the course for FarCry 6.x. If you can help let us know! Put your notes in the comments for the page. Add the following advanced form walkthrough for adding create/edit options in the front end:
|
Objectives
Excerpt |
---|
After completing this unit you will be able to build your own FarCry forms to edit and save content objects. |
...
- Paste the following code below the <cfimport /> tag but above our form:
Code Block <!--- Form processing ---> <ft:processForm action="Save"> <ft:processFormObjects objectid="#stobj.objectid#" /> </ft:processForm>
- Now go and edit a Super Hero and this time when you press Save, notice that your data has, in fact, been saved
- Great, but when we hit Save or Cancel, we don't actually just want to keep refreshing the page; we need it to exit out to where we came from or wherever the calling page tells us to go
- Paste the following code below our current <processForm /> tag
Code Block <ft:processForm action="Save,Cancel" exit="true" />
- Now go and save your Super Hero and see what happens
Bonus Lab: Building Forms in the Front End
In addition to changing the default behaviour of forms in the webtop, its also possible to build forms using formtools directly in the front end of your website.
- Build a type webskin listing content items of a particular type
- Put in an "ADD" button and link to a type webskin for adding new content (eg. displayTypeAdd.cfm)
- Create a temporary session object using the "key" attribute so you don't have to create a database record every time someone just views the form
- Call a custom edit handler to update the new record
- Process the form POST and redirect the user to your type listing page