[thelist] ASP variables from user form
rudy
r937 at interlog.com
Wed Aug 22 15:51:20 CDT 2001
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 ensures
that the action page will not bomb out because you changed something on the
form submit page -- and as well, it's really nice documentation for the
fields that the action page expects
</tip>
rudy
More information about the thelist
mailing list