check box problem with access

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default 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

  2. Similar Questions and Discussions

    1. 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...
    2. 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...
    3. 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 =...
    4. 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...
    5. 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....
  3. #2

    Default 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

  4. #3

    Default 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

  5. #4

    Default 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

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139