I managed to include the one for qForms. :)
> RE form management tool:
> http://www.electricsheep.co.nz/terraform/ if you
> want to have a look. But it doesn't run on 4.5 as it
> relies heavily on UDFs.
> Also you would basically need to rewrite your form. One
> advantage would be
> that the resulting form is much more readable. Here's how
> I'd make yours
> more readable:
> <cfset options = "A,B">
> <SELECT name="AA">
> <cfoutput>
> <cfloop list="#options#" index="option">
> <OPTION
> value="#option#" <cfif
> not
> CompareNoCase(QName.AA,option)> selected</cfif>>Choice
> #option#</option>
> </cfloop>
> </cfoutput>
> </SELECT>
> This doesn't look better, but you could make a custom tag:
> <cfparam name="attributes.options">
> <cfparam name="attributes.value">
> <cfparam name="attributes.field">
> <cfoutput>
> <SELECT name="#attributes.field#">
> <cfloop list="# attributes.options#" index="option">
> <OPTION
> value="#option#" <cfif
> not
> CompareNoCase(attributes.value,option)>
> selected</cfif>>Choice
> #option#</option>
> </cfloop>
> </SELECT>
> </cfoutput>
> I guess you were asking about speed. The sad fact is that
> the fastest code
> is often the ugliest and least elegant, and least
> maintainable -- the
> fastest code is the code that is most similar to a static
> page. However the
> speed gain is likely to be miniscule. To me both those
> code examples look
> bad and I wouldn't want to be maintaining that code.
> -----Original Message-----
> From: S. Isaac Dealey [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, 17 December 2003 3:21 p.m.
> To: CF-Talk
> Subject: Re: BIG Forms: CFSWITCH or CFIF?
> Personally I'd recommend neither ...
> I doubt the cfswitch will save you any processing speed in
> this
> particular case. However, I'd go for a function or custom
> tag to
> handle your form elements and pass a structure to them to
> populate the
> individual fields. Inside the tag, check the structure for
> the
> appropriate key and use it if available to populate the
> field -- this
> will cut down on your typing and improve consistency
> within the
> application at the expense of a little processing time.
> Matthew Walker produces a really nice form management tool
> that does
> this ... I don't remember what he charges for it, but I'm
> sure he'd be
> willing to discuss licensing for inclusion in other apps
> if you're
> wanting to sell something.
> Otherwise there's also the qForms _javascript_ API which is
> open-source
> and pretty good in comparison to a lot of other OS
> projects that tend
> to be tough to work with. http://www.pengoworks.com ...
> Once you've
> got it installed in your app, then you can populate your
> whole form
> with something like this:
> <cfloop index="x" list="#qname.columnlist#">
> <cfparam name="form.#x#" default="#qname[x][1]#"></cfloop>
> <script type="_javascript_">
> function temp() {
> <cfwddx action="" input="#form#"
> toplevelvariable="myValues">
> myForm = new qForm("myformname");
> myForm.setFields(myValues);
> } window.> > </script>
> This cuts down all that cfif or cfswitch stuff... The
> onTap framework
> now has a qForms library that makes this even easier,
> though I
> scarcely see you plugging an existing app into the
> framework. :) In
> any event, with the qForms library in an onTap application
> this whole
> 8 or so lines of code here can be condensed to one or two
> calls to a
> UDF.
>> I'm going over old code that has pre-filled form fields
>> based on previous user entry. Many are select boxes or
>> radio groups with lots of options. The current coding
>> method is shown in Method 1 below. The common way I see
>> recommended to do this is in Method 2. Before I rewrite
>> this code, I thought I'd ask which y'all think is the
>> better approach for a big form.
>> Method 1 is verbose, but its use of cfswitch might be
>> faster?
>> Method 2 is easier to code, but uses slower cfifs. Lots
>> of them on longer forms.
>> So on a form with a couple of dozen fields like this,
>> which do you think is faster/a better approach?
>> <!---METHOD 1--->
>> <cfparam name="variables.LocalAA01" default=""
>> type="string">
>> <cfparam name="variables.LocalAA02" default=""
>> type="string">
>> <cfswitch _expression_="#QName.AA#">
>> <cfcase value="A">
>> <cfset variables.LocalAA01=" selected">
>> </cfcase>
>> <cfcase value="B">
>> <cfset variables.LocalAA02=" selected">
>> </cfcase>
>> <cfdefaultcase>
>> <cfset variables.LocalAA01=" selected">
>> </cfdefaultcase>
>> </cfswitch>
>> <SELECT name="AA">
>> <OPTION value="A"#variables.LocalAA01#>Choice A
>> <OPTION value="B"#variables.LocalAA02#>Choice B
>> </SELECT>
>> <!---METHOD 2--->
>> <SELECT name="AA">
>> <OPTION value="A"<cfif not CompareNoCase(QName.AA,"A")>
>> selected</cfif>>Choice A
>> <OPTION value="B"<cfif not CompareNoCase(QName.AA,"B")>
>> selected</cfif>>Choice B
>> </SELECT>
>> --
>> -------------------------------------------
>> Matt Robertson, [EMAIL PROTECTED]
>> MSB Designs, Inc. http://mysecretbase.com
>> -------------------------------------------
>> --
>>
> _____
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

