Hello. I have two questions regarding form reuse. Since this is the first time I am building a real FB3-based application, I am not sure whether I am doing things in the most appropriate way.
Imagine a page displaying a list of products and a link to add a new item. Clicking on a product will display a page with its details. This is possible because each of the links includes an 'id' attribute in the URL. From the 'details' page, a user may choose to edit the product's information. The switch of the circuit containing these fuseactions could include: <cfcase value="addItem"> <cfset pageTitle = "Add item"> <cfset buttonLabel = "Add"> <cfinclude template="dspEditForm.cfm"> </cfcase> <cfcase value="details"> <cfset xfa.edit = "products.editItem"> <cfinclude template="qryDetails.cfm"> <cfinclude template="dspDetails.cfm"> </cfcase> <cfcase value="editItem"> <cfset pageTitle = "Edit item"> <cfset buttonLabel = "Update"> <cfinclude template="qryDetails.cfm"> <cfinclude template="actSetFormVariables.cfm"> <cfinclude template="dspEditForm.cfm"> </cfcase> The dspEditForm is shared by both the addItem and the editItem fuses. The title of the page and the label of the button are configured via simple variables. Inside the dspEditForm fuse, the form fields are cfparam'ed to zero (i.e. unless values are provided, the form fields will be blank). Now for the questions: 1) From the list of products, a user can click an item to see its details. The item's id is included in the URL, so when we get to the 'details' fuseaction, the id will be available both to the query that will retrieve data and to the page that will display the results. This last one will also include a link to edit the information being shown. However, the target of this link is set through an XFA; in this case, it is 'xfa.edit', which equals 'products.editItem'. How should the current item's id be passed on to the 'editItem' fuseaction? Should it be included in the XFA (i.e. xfa.edit = "products.editItem&id=#attributes.id#") or should a variable be set? What is the best practice here? 2) When reusing a form to edit an item, that item's data must be loaded first and transferred to the form fields. In the example above, there is an action fuse called 'actSetFormVariables.cfm' that will copy the results of the query into variables that the display fuse with the form will read from. It works, but again, what is the best practice here? Thank you, -- Ney Andr� de Mello Zunino Media and Technology Laboratory Campus Computing Centre United Nations University ==^================================================================ This email was sent to: [email protected] EASY UNSUBSCRIBE click here: http://topica.com/u/?bUrFMa.bV0Kx9 Or send an email to: [EMAIL PROTECTED] T O P I C A -- Register now to manage your mail! http://www.topica.com/partner/tag02/register ==^================================================================
