Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Warning
titleWork in Progress

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:

  • type webskin listing existing objects
  • link to type webskin for adding new content (eg. displayTypeAdd.cfm)
  • showcase creating a session object, and use of "key" attribute
  • call custom edit handler
  • process form and redirect to type listing page

Objectives

Excerpt

After completing this unit you will be able to build your own FarCry forms to edit and save content objects.

...

  1. 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>
    
  2. Now go and edit a Super Hero and this time when you press Save, notice that your data has, in fact, been saved
  3. 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
  4. Paste the following code below our current <processForm /> tag
    Code Block
    <ft:processForm action="Save,Cancel" exit="true" />
    
  5. 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