look at the cfparam tag
example:
<cfparam name="form.sku" default="somesku" />
This effectively says, if form.sku is undefined, define it and set it to
somesku.
DK
On 3/11/07, Robert Reil <[EMAIL PROTECTED]> wrote:
Here is a quickie:
I have a form.cfm
It posts to a formaction.cfm.
it works.
I copy the content of form.cfm to the top of formaction.cfm.
Save it.
using form.cfm puts me to formaction.cfm.
Another query using the form at the top of formaction.cfm works.
but if I close the browser and open it to formaction.cfm it errors with
Element SKU is undefined in FORM.
The error occurred in
*C:\Inetpub\wwwroot\intranet.motorcyclecarbs.com\sales\search.cfm:
line 5*
3 : FROM carbs.products
4 : WHERE sku = <cfqueryparam cfsqltype="cf_sql_varchar"
*5 : value="#FORM.sku#" maxlength="40" />*
6 : </cfquery>
7 :
I understand this as a variable needs to be given to #form.sku# as it is passed
from form.cfm to formaction.cfm and a closing of the browser breaks this
variable having a value
The question is how would I assign an empty value to this variable to keep it
from crashing upon opening the file?
Code snippet:
----------------------
<cfquery name="product" datasource="carbs">
SELECT Product_ID, Name, SKU, Description1, Description2, Vend_Name, Image1,
Image1Params
FROM carbs.products
WHERE sku = <cfqueryparam cfsqltype="cf_sql_varchar"
value="#FORM.sku#" maxlength="40" />
-----------------------
I would think that I should use a <cfif #FORM.sku#="" make FORM.sku = 0>
<cfelse #FORM.sku#>
I hope that makes sence and IM sure im on the right track but not clear. Some
help would be awesome.
Guys... Im writing code! Im excited!! Yeah I know... Dumb NOOB!
Robert P. Reil
Managing Director,
Motorcyclecarbs.com, Inc.
4292 Country Garden Walk NW
Kennesaw, Ga. 30152
Office 770-974-8851
Fax 770-974-8852
www.motorcyclecarbs.com
--
Douglas Knudsen
http://www.cubicleman.com
this is my signature, like it?
-------------------------------------------------------------
To unsubscribe from this list, manage your profile @
http://www.acfug.org?fa=login.edituserform
For more info, see http://www.acfug.org/mailinglists
Archive @ http://www.mail-archive.com/discussion%40acfug.org/
List hosted by http://www.fusionlink.com
-------------------------------------------------------------