[thelist] ASP variables from user form

spinhead evolt at spinhead.com
Wed Aug 22 17:38:00 CDT 2001

whooeee; you and scott each gave good arguments for opposite approaches.
yours allows for no changes in the future, just additions (nice clean
update.) scott's allows for cleaner code at the end (in asp, if I want to
check for the existence of a variable, it's just an if-then thingy, afaik;
and these would just linger causing me anal retentive stress)

neither of you mentioned drawbacks to carrying a bunch of variables along
with me as I go. if that's not really a perceptible negative, does this end
up being a personal choice?


----- Original Message -----
From: "rudy" <r937 at interlog.com>
To: "evolt thelist" <thelist at lists.evolt.org>
Sent: Wednesday, August 22, 2001 1:46 PM
Subject: Re: [thelist] ASP variables from user form

> good question, joel
> > 1. On the form page, then pass it to the action page
> > 2. On the action page, as the value of a string to be passed
> >        to the SQL insert command
> > 3. In the SQL insert command itself
> 2 and 3 are basically identical, as far as maintainability is concerned
> if you have the equivalent of cfparam in asp, then you can leave the
> fields out of the form until they become dynamic, default them to their
> static values at the top of the action page, and never touch the query
> again
> this also allows you to do error-checking to ensure your action page is
> actually called by the form submit page -- if all the form fields have
> their default static values, it means that the form was not submitted
>   <cfparam name="form.foo" default="staticfoo">
>   <cfparam name="form.bar" default="staticbar">
>   <cfif form.foo is "staticfoo"
>      and form.bar is "staticbar">
>             <!--- bad form submit --->
>   <cfelse>
>   <cfquery>
>      insert into mytable
>         values ('#form.foo#','#form.bar#')
>   </cfquery>
>   </cfif>
> sorry, i don't know what the asp equivalent of cfparam is
> basically it says if the parameter does not exist, create it and give it a
> default value, otherwise leave it alone
> <tip comment="shamelessly building up my tip credit balance">
> putting a cfparam for each form field at the top of the action page
> that the action page will not bomb out because you changed something on
> form submit page -- and as well, it's really nice documentation for the
> fields that the action page expects
> </tip>
> rudy
> ---------------------------------------
> For unsubscribe and other options, including
> the Tip Harvester and archive of TheList go to:
> http://lists.evolt.org Workers of the Web, evolt !

More information about the thelist mailing list