> I maintain code on a lot of sites. Scoping has never > confused me. I don't > know why or why it doesn't slow me down but it does > everyone else, but it > seems to. > To save coding, I have been known to do: > <cfparam name="fname" default="#queryname.fname#">
> That way when the form is first hit it is populated with > "" because the ID > for the query is 0 and a new record is created. When the > form is hit the > second time, it is an edit for the object. I've been known to do something like this... though I usually do it like this: <cfloop index="x" list="#myquery.columnlist#"> <cfparam name="form.#x#" type="string" default="#myquery[x]#"></cfloop> Gets all the query vars into the form and then use the form variables to populate the html form -- if an error occurs when submitting I display the form again and the form values submitted supplant the query values so the user doesn't have to type it in again... Helps make the UI nice for the visitor. I don't see leaving off "form." as really being a time saver... Granted, I don't know how fast you type... I type pretty fast, but I know everybody's different and I've known programmers who because of arthritis or whatever other reason are always looking for ways to shave off just a keystroke or two. But if you really wanted to do both, you could -- save the keystrokes and scope, by using a custom tag(s) or udf(s) to populate the form. Or if your clients are happy with the idea of JavaScript, the one that I really like is the qForms API ... http://www.pengoworks.com ... the code looks like this: <script language="javascript"> function myonload() { <cfwddx action="cfml2js" input="#form#" toplevelvariable="frmData"> myqform = new qForm("myhtmlform"); myqform.setFields(frmData); } </script> That sets all the fields in the form with the values from the form scope. I'd put this into a custom tag that takes in the name of your form as an attribute and then it'd just be: <cf_formload form="myformname"> And don't bother using any output or putting any variable names in your individual fields. One of these days I really should get around to writing a function library and/or custom tags for the qForms API for the onTap framework. It's already got a lot of JavaScript DOM stuff in it, qForms would be right at home. s. isaac dealey 972-490-6624 team macromedia volunteer http://www.macromedia.com/go/team chief architect, tapestry cms http://products.turnkey.to onTap is open source http://www.turnkey.to/ontap ----------------------------------------------- To post, send email to [EMAIL PROTECTED] To unsubscribe: Send UNSUBSCRIBE to [EMAIL PROTECTED] To subscribe / unsubscribe: http://www.dfwcfug.org
