Skip to main content
Participating Frequently
November 9, 2006
Question

Varible Undefined

  • November 9, 2006
  • 19 replies
  • 1522 views
My company has a db of events. Uses submit them and admins are e-mail. This page is for "approval" after the event is approved it will be show on the main page. I keep gettign Varible ZERO undefined error and im nto sure why. Ill attach the form and the action page. If you need more information of more of an explination email em at TFort@PreventPollution.org
This topic has been closed for replies.

19 replies

Participating Frequently
November 10, 2006
You're welcome

:-)
TomFortAuthor
Participating Frequently
November 10, 2006
Well it works!

I rememberd to remove quote form around the start/end date and also the true/false and it works!

Thanks Kronin you ahve helped me so much I really appociate all the help.
Participating Frequently
November 10, 2006
Can you run this in Access directly?

UPDATE 1Events
SET Approved = 'True', Zero = 'False', City = '', State = ''
WHERE WorkshopKey = 71

A couple things to try... I don't know Access, I've actually never used it, but from other databases here's what I'd try...

1) try removing the single quotes around the true/false values
UPDATE 1Events
SET Approved = True, Zero = False, City = '', State = ''
WHERE WorkshopKey = 71

2) try changing those to 0/1
UPDATE 1Events
SET Approved = 1, Zero = 0, City = '', State = ''
WHERE WorkshopKey = 71
TomFortAuthor
Participating Frequently
November 10, 2006
I did that sorry forgot to say that but ya I added the <cfparam>

Workshopkey = Autonumber
Startdate = date/time
enddate = date/time
EventDesciption = memo
eventname , contact, mailto,contactphone,contactorg,website,otherinfolink,city,state = text
zero = yes/no ( true/false format)
Approved = yesno (true/false format)

Only field I can think is start/enddate and the form for those is.
<input type="text" name="EndDate" value="#DateFormat(Recordset1.EndDate, 'M-D-YYYY')#">
TomFortAuthor
Participating Frequently
November 10, 2006
That makes so much since.
Well there still sadly an issue . But now all varibles pass!

Error Executing Database Query.
[Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.

The error occurred in C:\CFusionMX\wwwroot\0-waste\admin\Events\Approved\ACT_edit.cfm: line 25

23 : State = '#State#'
24 : WHERE
25 : WorkshopKey = <cfoutput>#WorkshopKey#</cfoutput>
26 : </cfquery>
27 : <cfinclude template="detailtest.cfm">


But all varibles are passed as shown here:

UPDATE 1Events
SET Approved = 'True', Zero = 'False', City = '', State = ''
WHERE WorkshopKey = 71
TomFortAuthor
Participating Frequently
November 10, 2006
That makes since well the first time around it said that zero and approve were not defined in form so i though that would fix it but it seems I just messed it up even more . Well let me see if taking those out helps.
Participating Frequently
November 10, 2006
Tom,

Did you read my first reply to you?

"Add the following to the top of your action page:
<cfparam name="FORM.Zero" default="False">"

That fixes the whole "Zero is undefined in FORM" business. Do the same thing to Approved as well.

Now, as far as the data type mismatches...
What are the datatypes of all the columns in that table?
Participating Frequently
November 10, 2006
This is your problem:

<input type="hidden" name="Zero" value="#Recordset1.Zero#">
<input type="hidden" name="Approved" value="#Recordset1.Approved#">

Why are you passing them as hidden fields? If 2 fields have the same name on a form, then the values are combined as a comma-delimited list. What are you trying to accomplish by passing these hidden fields around?
TomFortAuthor
Participating Frequently
November 10, 2006
Oh sorry didnt see that. I really do thank youf ro all the help your giving me its nice to know a neebie can get so much help.

//from form page

<cfoutput query="Recordset1">
<form method="POST" name="form" action="act_edit.cfm">
<table align="center">

<tr valign="baseline">
<td nowrap align="right">Approve</td>
<td> <input type="checkbox" name="Approved" value="True" <cfif Recordset1.Approved is True>checked="Yes"</cfif>/> </td>
</tr>

<tr valign="baseline">
<td nowrap align="right">Zero Waste</td>
<td> <input type="checkbox" name="Zero" value="True" <cfif Recordset1.Zero is True>checked="Yes"</cfif>/></td>
</tr>


<input type="hidden" name="Zero" value="#Recordset1.Zero#">
<input type="hidden" name="Approved" value="#Recordset1.Approved#">
<input type="hidden" name="WorkshopKey" value="#Recordset1.WorkshopKey#">
</form>

//action page is same as the one i posted but here it is again.

<cfparam name="FORM.Approved" default="False">
<cfparam name="FORM.Zero" default="False">
<cfset Zero = FORM.Zero>
<cfset Approved = FORM.Approved>
<cfset WorkshopKey = FORM.WorkshopKey>
<cfquery name="EditEvents" datasource="testEvents">
UPDATE
1Events
SET
EventName = '#EventName#',
StartDate = '#StartDate#',
EndDate = '#EndDate#',
EventDescription = '#EventDescription#',
Contact = '#Contact#',
MailTo = '#mailto#',
ContactPhone = '#ContactPhone#',
ContactOrganization = '#ContactOrganization#',
Website = '#Website#',
OtherInfoLink = '#OtherInfoLink#',
Approved = '#Approved#',
Zero = '#Zero#',
City = '#City#',
State = '#State#'
WHERE
WorkshopKey = <cfoutput>#WorkshopKey#</cfoutput>
</cfquery>
<cfinclude template="detailtest.cfm">


See both approve and zero have issues. So if i can fix one I can fix the other.
Participating Frequently
November 10, 2006
Tom, I'll quote from my previous post:

> Post all the occurences of Approved on both the form and the action page.
TomFortAuthor
Participating Frequently
November 10, 2006
The whole issues is that fact its passing the varibles "0,true" and if i rember correctly boolean for true is 1.
We are using access for the db.
The form field is set to true/false so all i need it to do is pass true if check flase if not checked.