Ask a Question related to Coldfusion Database Access, Design and Development.
-
jjsand28 #1
check box problem with access
I've been working on this all day and I cannot figure it out. The checkboxes do
not enter int the Access db at all. It worked fine until I changed the way
forms are processed. Now they all work as includes in the main page. I will
only give you the relevent info for space purposes. I've got two giving me
problems (the only two) form.noEmail and form.private Here's the main form
page: <!--- default values for the page ---> <CFPARAM name='URL.Action'
default='Add'> <CFPARAM name='step' default='input'> <CFPARAM name='valError'
default=''> <!--- show page based on step ---> <CFSWITCH expression='#step#'>
<CFCASE value='process'> <CFINCLUDE template='gbookValidate.cfm'> </CFCASE>
<CFDEFAULTCASE> <CFINCLUDE template='gbookInput.cfm'> </CFDEFAULTCASE>
</CFSWITCH> here's the variables from the form itself: <!--- we set the form
fields ---> <CFSET form.entryID = #getEntry.entryID#> <CFSET form.name =
#getEntry.name#> <CFSET form.email = #getEntry.email#> <CFSET form.noEmail =
#getEntry.noEmail#> <CFSET form.location = #getEntry.location#> <CFSET
form.homepage = #getEntry.homepage#> <CFSET form.comments =
#getEntry.comments#> <CFSET form.private = #getEntry.private#> <CFSET
URL.Action = #URL.Action#> <CFELSE> <!--- if the entryID was not passed we
just fill the form with blank information ---> <CFPARAM name='form.entryID'
default=''> <CFPARAM name='form.name' default=''> <CFPARAM name='form.email'
default=''> <CFPARAM name='form.noEmail' default=''> <CFPARAM
name='form.location' default=''> <CFPARAM name='form.homepage' default=''>
<CFPARAM name='form.comments' default=''> <CFPARAM name='form.private'
default=''> <CFPARAM name='URL.Action' default='Add'> </CFIF> here's the
checkbox in the form <INPUT <cfif (#form.noEmail# EQ 1)>checked</cfif>
name='form.noEmail' type='checkbox' value='1'> And finally here's the
processing query: <CFCASE value='add'> <CFQUERY name='addEntry'
datasource='#Application.dsn#'> insert into
sig_guestbook(Name,Email,noEmail,Location,Homepage ,Comments,private,IPAddress,En
tryDate) values('#form.Name#','#form.Email#', <CFIF
isdefined('form.noEmail')>1,<CFELSE>0,</CFIF>
'#form.Location#','#Homepage#','#boxFormat(form.Co mments)#', <CFIF
isdefined('form.private')>1,<CFELSE>0,</CFIF>
'#cgi.REMOTE_ADDR#','#DateFormat(now())#') </CFQUERY> Now when I go through
the process the check boxes are not marked in the Access db. Even if I change
them in the db and edit the entries they are reverted back to the way they were
before I changed the db. Thank you in advance for any and all assistance with
this headache.
jjsand28 Guest
-
Check in/Check out problem
Hi, I have made a site with DW MX which is being updated by Contribute. Due a computer a had to install DW again an somewhere I have enabled... -
site check - weird problem
Has anyone ever experienced this before? I have a site, www.soundgems.net, with certain pages that behave weird in IE on a mac. The pages that act... -
Check code is running: Access/VBA from ASP
Hi Guys I am using this code to execute an Access VBA function from ASP: strDbName = strDataSource & "data\webjobs.mdb" Set objAccess =... -
Conversion problem from Access 97 to Access 2002
I have an old access 97 database and I tried to convert to Access 2002. After the conversion, some of the forms and all modules are not converted... -
Problem with check box in continuous form
I've created a continuous tabular form with an added check box field that initiates some automated text insertion (via macro) when clicked.... -
The ScareCrow #2
Re: check box problem with access
To me it appears that the checkboxes are never defined in the form.
Comment out the cfquery code to insert and do a cfdump of the form to confirm
if the checkboxes are in the form.
If they are not then you will need to check the code that includes the page
containing the checkboxes to ensure they are in the form.
Ken
The ScareCrow Guest
-
jjsand28 #3
Re: check box problem with access
You were right they were not there. Which they should be unless I'm thinking
wrong. The very first page has these lines <CFSET form.noEmail =
#getEntry.noEmail#> They are only triggered if the record ID is passed through
a URL. But if not they are still supposed to be created, just empty. <CFPARAM
name='form.noEmail' default=''> Somehow they get lost with all the includes
but if I remove the scope on the variables then they work fine. In your
opinion, is that okay to keep it that without the scopes or should I find out
how to do it another way.
jjsand28 Guest
-
The ScareCrow #4
Re: check box problem with access
I'm not sure why you are defining params for the checkboxes.
The nature of the checkboxes is
If they are checked, then they are defined
If they are not checked, then they are not defined.
By defining them in the params, they are always defined, so how do you know
when it has been checked ?
In the case of the noEmail, I assume this is just a switch 1/0 on/off
So if it is checked then set the field to 1, if it is not checked then set to
zero.
If this is the case, and you want to have the params, then
Set the param to zero
<CFPARAM name="form.noEmail" default="0">
Then in the cfquery, as you have defined it in the param, just assign the value
<CFQUERY name="addEntry" datasource="#Application.dsn#">
insert into
sig_guestbook(Name,Email,noEmail,Location,Homepage ,Comments,private,IPAddress,En
tryDate)
values('#form.Name#','#form.Email#',
#form.noEmail#,
'#form.Location#','#Homepage#','#boxFormat(form.Co mments)#',
<CFIF isdefined("form.private")>1,<CFELSE>0,</CFIF>
'#cgi.REMOTE_ADDR#','#DateFormat(now())#')
</CFQUERY>
But, you still need to work out, why the checkboxes are not defined in the
form if they are checked ?
Ken
The ScareCrow Guest



Reply With Quote

