If all my forms and listings pages are going to look pretty much the same, I
develop 2 dsp_ files, a,  dsp_list and a dsp_form. Both of these expect an
array of structures generated by an associated act_ file, for act_list.cfm:

 stData = StructNew();
 stData.aColumns   = aColumns;
 stData.Width   = "600";
 stData.aRows   = aRows;
 stData.RowsPerPage  = 25;

Where aColumns contains all the columns I want to display:

 i = i + 1;
 aColumns[ i ] = StructNew();
 aColumns[ i ].Key = "FirstName";
 aColumns[ i ].Label = "First Name";
 aColumns[ i ].Align = "Center";
 aColumns[ i ].Width = 200;

And aRows contains the actual rows as an array of structures:

aRows[ r ] = StructNew();
aRows[ r ].label = qRows.first_name[ r ];

etc.

The form tag handles the output of many types of form fields and the fields
are detailed like:

 f = f + 1;
aForms[ i ].Fields[ f ] = StructNew();
aForms[ i ].Fields[ f ].Label   = "Label";
aForms[ i ].Fields[ f ].Type   = "Text";
aForms[ i ].Fields[ f ].Value   = attributes.label;
aForms[ i ].Fields[ f ].Name    = "label";
aForms[ i ].Fields[ f ].Attributes  = "size='40' maxlength='64'
style='width: 400px;' class='flat'";

Where aForms is the form on the page (I allow many) and Fields is an array
of fields in that form. Depending on the 'Type' the keys required in the
structure differ slightly.

I got the idea from this after using spectra and its nice cfa_datasheet (or
whatever it was called) tag, and decided to create my own. It makes creating
the Manager interface to a site soooo quick once its all set up. It needs a
lot more work to make it completely generic, maybe when I get more time...

This is probably a little confusing as described here, if you would like
some sample files, I can email them off list or post them somewhere.

Thanks,

Ant

----- Original Message -----
From: "Kay Smoljak" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, May 23, 2002 9:58 AM
Subject: form re-use


> Hi all,
>
> Over my last couple of projects, I have tried a couple of different ways
> to resuse forms (ie a single fuseaction for add or edit product, for
> example). I'm not really happy with any of them. Now I'm about to start
> a new large project, and I want it to be the bestest ever :) Does anyone
> have any *really elegant* methods for reusing forms that they would like
> to share?
>
> Kay.
>
>
>

==^================================================================
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
==^================================================================

Reply via email to