Subforms, Eh? Part I of III
"Michael Cortez" <mcortez-8sipqmjc3J32fBVCVOL8/[email protected]> Wed, 6 Apr 2005 12:23:20 -0700
| Newsgroups | gmane.comp.cms.xaraya.knowledge-base |
|---|---|
| Message-ID | <[email protected]> |
Subforms is a new property type introduced by mikespub a little while back. Up until now it's been a complete mystery for most of us to use, and wasn't complete. I've had a chance to flesh out a little extra bit, enough to get the 'list of children' mode "useful" but have not gotten it anywhere near "complete" or robust. But subforms are now useable. This is an attempt to explain SubForms' use. Subforms works in one of three modes or styles "local value", "link to item" and "list of children." This post explains the use of the 'local value' style. Local Value =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Local Value allows you to have a 1 to 1 relationship between a parent object and a child object. The child object is stored along with the parents data (as serialized array.) A good example for this style, would be an address block. So lets image a website where anonymous consumers submit forms to get rebates or junk mail sent to them. This site will have a dozen or more different Article Publication Types for each different form that a consumer might want to fill out. On each of this PubTypes you want to ask for the consumer's address. For whatever reason, you (or your paying client) have decided that you don't want users to log in, so simply a adding address fields to Roles is not an option. Traditionally this had meant that you would need to define the set of address fields on each and every PubType. And if you wanted to make a change (5 Digit ZipCode to 9 Digit, or to add a second street line, or a C/O line) then you would have to edit and change the properties on each PubType. Here are the steps that will allow you to define a single DD Object for address block and use it for all those separate PubTypes. Step 0 -- Prerequisites * Function Xaraya Site running off BK/Xaraya-Core/Stable as of Noon PST April 06, 2005 * Installed Articles & DD * Hooked DD to Articles Step 1 -- Create a DD Object for the Address Block =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D 1. Admin Menu -> Dynamic Data -> View Objects -- Click on "Create New" 2. Specify for the name: AddressBlock 3. Specify for the label: Address Block 4. Leave all the other fields as their default, and click "Create" 5. Scroll down to the AddressBlock object, and click "Edit" 6. Click "Modify Dynamic Properties" 7. Add the following Properties as if you were adding them to a pubtype: Label PropertyType Default ------- ------------- ------- itemid Item ID 0 Street Text Box City Text Box Zip/Postal Code Text Box State/Province Text Box County Text Box Step 2 -- Create a PubType that will use a SubForm property to display the address block =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 1. Admin Menu -> Articles -> Publication Types -- Click on "Create New Publication Type" 2. Specify Type as : SampleForm 3. Specify Description as : Sample PubType for SubForms 4. Unselect the "Input" checkbox for Summar and Body. 5. Change the title field's label to : Name 6. Click Create 7. Click on 'Edit' for the SampleForm pubtype 8. Next to 'Dynamic Data Fields' click on [ modify ] 9. Add the following property: Label PropertyType Default ------- ------------- ------- Address Sub Form=20 10. Click Update Propeties 11. Click on the 'Validation' label for the Address property 12. For object, select "AddressBlock" from the dropdown 13. For style, select "Local value" 14. Click Update Step 3 -- Test =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 1. Admin Menu -> Articles -> Add Article -> Sample Form.