How to use a checkbox - Yes/No in a db update form

Hello;
I'm trying to use a check box on a form, I created. I need a function or not. If it is enabled, it's Yes, if not, not.

I have it in a form that can add a "user" or to update an existing record. For now, it is throwing an error and it is for the code in the box. The following code is important for that and the error:

page userEdit.cfm

< name cfparam = "url. RecordID' type = 'integer' default '0' = >
< name = "cfparam variables.ID" type = "integer" default = "#url." RecordID #">"
< name cfparam = "variables. Default Pnom"=" ">
< name cfparam = "variables. Default lname"=" ">
< name = "cfparam variables.userName" default = "" > "
< name = "cfparam variables.password" default = "" > "
< name = "cfparam variables.email" default = "" > "
< name = "cfparam variables.admin" default = "" > "

< cfif url. RecordID GT 0 >
< name cfquery = "useRec" datasource = "#APPLICATION.dataSource #" >
SELECT user. FName, user. Lname, user.userName user.password user.email, user.admin, user.ID
The USER
WHERE user.ID = < cfqueryparam value = '#URL. "RecordID #" cfsqltype = "cf_sql_integer" >
< / cfquery >

< cfif useRec.RecordCount EQ 1 >
< cfset variables. RecordID = useRec.ID >
< cfset variables. Fname = useRec.Fname >
< cfset variables. Lname = useRec.Lname >
< cfset variables.userName = useRec.userName >
< cfset variables.password = useRec.password >
< cfset variables.email = useRec.email >
< cfset variables.admin = useRec.admin >
< / cfif >
< / cfif >
< head >
......
< body >
< cfoutput >
< action = "action.cfm cfform" method = "post" > "
< cfinput type = "hidden" name = "ID" value = "#variables.ID #" >
... more for the fields here...
< cfinput type = "checkbox" name = "admin" value = "#variables.admin #" >
... introduce buttons here...
< / cfform >
< / body >

«"" "Action page:»»"»

< isDefined ("Form.RecordID") cfif >
< cfquery datasource = "#APPLICATION.dataSource #" >
UPDATE user
User SET. Fname = < cfqueryparam cfsqltype = "cf_sql_varchar" value = "#form. ' Fname # ' >.
user. Lname = < cfqueryparam cfsqltype = "cf_sql_varchar" value = "#form. "Lname # ' >.
user.userName = < cfqueryparam cfsqltype = "cf_sql_varchar" value = "#form.userName #" >.
User.Password = < cfqueryparam cfsqltype = "cf_sql_varchar" value = "#form.password #" >.
User.email = < cfqueryparam cfsqltype = "cf_sql_varchar" value = "#form.email #" >.
User.admin = < cfqueryparam cfsqltype = "cf_sql_varchar" value = "#form.admin #" >
WHERE ID = < cfqueryparam value = '#form. "RecordID #" cfsqlType = "CF_SQL_INTEGER" >
< / cfquery >
< cflocation url = "indexUser.cfm? "RecordID = #Form.RecordID # ' addtoken ="no">
< cfelse >
< result cfquery = "GetNewRecord" datasource = "" #APPLICATION.dataSource # "dbtype ="ODBC">"
INSERT INTO user
(Fname Mname, Lname, username, password, email, admin)
VALUES (< cfqueryparam cfsqltype = "cf_sql_varchar" value = "#form.) ' Fname # ' >.
< cfqueryparam cfsqltype = "cf_sql_varchar" value = "#form. "Lname # ' >.
< cfqueryparam cfsqltype = "cf_sql_varchar" value = "#form.userName #" >.
< cfqueryparam cfsqltype = "cf_sql_varchar" value = "#form.password #" >.
< cfqueryparam cfsqltype = "cf_sql_varchar" value = "#form.email #" >.
< cfqueryparam cfsqltype = "cf_sql_varchar" value = "#form.admin #">) "
< / cfquery >
< cflocation url = "indexUser.cfm" >
< / cfif >

My error message:

Run database query error. [Macromedia] [SequeLink JDBC Driver] [ODBC Socket] [Microsoft] [ODBC Microsoft Access driver] Number of query values and destination fields is not the same.
The error occurred on line 33.

That's the line where it is supposed to put the checkbox in the database on the action page.
How to use a checkbox for this? The box is the admin in the db and that is set to a value of yes/no tab

Thank you.

CFmonger

Quote:


Posted by: CFmonger
I have corrected the error, it is not that throw more. He made a new record now when I check the checkbox.

I think we should probably with me that this box will do when it updates or adds a new record in the database scope? Fix? That is why it adds a new record instead of just checking the Yes/No in the database table.

If it's my problem, how do I reach the present?

This isn't your problem. The code in the OP shows the application update and insert the same if/else logic-driven.

Tags: ColdFusion

Similar Questions

  • How to use the checkbox to select several lines of af: table

    Hi all
    I want to use the checkbox to select several lines of af: table

    Kind regards
    Tom

    Hello

    look at this link
    http://Sameh-Nassar.blogspot.com/2009/12/use-checkbox-for-selecting-multiple.html

    Kind regards
    Felix

  • How uncheck you a checkbox to the radio while CREATING a form?

    There are a lot of discussions about how to disable a checkbox radio on a form to fill out, but what about when the form was created? I get 2 phone numbers in my form and I need the customer to check their main phone number. So I really need a box of the radio. While creating the form in Acrobat, I hit preview to make sure that everything is going well and when I test the check radio boxes, one of them is activated and I can't cancel it. I don't want a default checked telephone numbers, but rather wish both uncontrolled until the client fills out the form. How can I get rid of this preview control?

    Yes, it will certainly work as you want with check boxes. As mentioned, the key is to give them the same name, but different value of exports (for example, Yes, no). You set the value to export on the Options tab of the field properties dialog box.

    To reset a form in Acrobat 9, select "forms > clear form.

  • How to use the checkbox to display the values of booolean?

    Hi all

    I'm learning to use APEX. I built an editable report after the 'top advanced tutorials', and I use static LOVs to insert Boolean values in two columns.
    The underlying table has two columns of type VARCHAR2 (1) NOT NULL with a a check constraint, so it must contain either 'Y' or 'n'), and the static LOV requires users to only choose beetween 'Yes' and «»

    I would use checkboxes to insert this field. Is this possible? Where can I find examples / tutorials about it?

    Thank you
    Andrea

    See this:

    http://www.inside-Oracle-apex.com/checkboxes-in-tabular-forms-the-easy-way/

    Denes Kubicek
    -------------------------------------------------------------------
    http://deneskubicek.blogspot.com/
    http://www.Opal-consulting.de/training
    http://Apex.Oracle.com/pls/OTN/f?p=31517:1
    -------------------------------------------------------------------

  • How to use the checkbox to update several lines

    Hi all

    I'm new to apex and I have a problem now. I find this code somewhere:

    BEGIN

    FOR I IN 1... APEX_APPLICATION. G_F01. COUNTING LOOP

    REMOVE FROM THE ASER

    WHERE ID = TO_NUMBER (APEX_APPLICATION. G_F01 (I));

    END LOOP;

    END;

    It can remove selected items, now I want to make some modifications to it.

    I want to update some columns when I ticked the box. How to make this change? I mean, like this:

    UPDATE ASER SET STATUS = '1' when I selected items

    Can you help me? Thank you!

    Hello

    I don't know exactly what you want to do, but if I am guessing right then of course you want updated also based on the elements of the selected check box.

    
    BEGIN
     FOR I IN 1 .. APEX_APPLICATION.G_F01.COUNT LOOP
    
       DELETE FROM ASER
      WHERE ID=TO_NUMBER(APEX_APPLICATION.G_F01(I)) ;
    UPDATE APSER
    SET STATUS = 1
    WHERE ID=TO_NUMBER(APEX_APPLICATION.G_F01(I)) ;
       END LOOP;
    
      END;
    

    But if not and you try rather to use these values to update another table after Session State is the way to go.

    Kind regards

    Benjamin.

  • OIM11gR2ps2 how to use OID - 11.1.1.6 Connector for updating a user that has been created through LDAPsync?

    Hello

    I have two connectors configuration, a database connector generic to an Oracle database that the provisions of a user account (it works fine). The second connector, I am still getting set up properly is a LDAP connector specifically OID - 11.1.1.6.0.

    Use case:

    A user creates an account through automatic recording and is created simultaneously in OUD ldap with the johnDoe1 username. johnDoe1 connects in IOM and asks an instance of application called DBAccount. They fill out the application in all there information (user ID, fname, lname, phone, address, title, etc.). Once they support demand goes through the necessary approvals and after that it's approved successfully the info is put in service to the database. Once this operation has been successful, I would like to provision an update a users ldap entry that was created in the custom attribute ldapsync is called OUDappusername, this attribute is an attribute with value mutli because if demand for the other apps, they will be updated in the OUD aswell. This OUDappusername will be generated by an event handler or to pre-populate the plugin and the format will be "app |" user name' where app is the app they ask and User_name is the user name they use to connect to the IOM, for example "DBAccount". johnDoe1. If they keep asking other apps they will be updated in the OUDappusername so that they may have DBAccount | johnDoe1 and ask another application called app2, then they will also have app2 | johnDoe1 and so on.

    Is this possible with the connector and how do I set it up to users update rather than set up a new account in the OUD?

    The question:

    I currently have the configuration of connector so whenever I have set up a user creates a new user rather than allow me to simply update a user. It is possible to configure the connector for updating existing users is born through ldapsync, rather than those created through the app instance configuration. I have found no documentation on that.

    Thanks in advance,

    J

    Edit #1 - I changed the wording and added more details.

    Edit #2 - I reworded my question to be more specific and focus on a single issue and changed the title to be more specific.

    Post edited by: 6d986dc3-6c9b-401d-9892-76032e7a1e05 on April, 07/04/2014

    Hello

    I just wanted to post what we found the answer. We did not use the connector, but what we did was we created a custom, adapter, which is a small and associated java class then new task in the process definition for the database resource in the console design and we made calls to jndi for the ldap Protocol to update this attribute multivalue. It was very quick and easy and could be tested before the implementation of the IOM. Thanks again for all the help and talk me through the procedures.

    Thank you

    J

  • How to use the "Order by" clause dynamically on values LOV Forms 10g r2

    Hello

    I have following requirement, please guide me.

    1. create a list of values with 2 fields, Code and Description

    2. do not use the command clause contained in the registration request Group

    3. fix this LOV on a form field

    4. when the user calls the user LOV will see two fields in LOV with header as Code and Description

    5. when the user clicks the column header "Code" then LOV should be arranged on Code

    6 and if the user clicks on the header of the column "Description" then LOV must be sorted on the Description


    Thanks in advance.

    Please post this problem in this forum->

    [Formulas Forum | http://forums.oracle.com/forums/forum.jspa?forumID=82]

    And close this thread by he scored as replied. ;)

    Kind regards.

    LOULOU.

  • How to change the visibility of an indicator programmically using a checkbox

    1. How do I change the visibility of an indicator of programmically using a checkbox?

    2. How can I change the color of a thermometer? I mean, this is how I can change the color when the temperature reaches a certain value?

    Nodes property.

    Right-click on your indicator.  Create > property Node > Visible.  Your Boolean checkbox wire that.

    For the thermometer to create a property node and choose FillColor.  A constant color box wire to one that is in its graphics & > range of image feature.

  • The Satellite A200 there Bluetooth? If yes how it used?

    My father gave me his old Sat A200 and I can't seem to understand how to use the built in bluetooth to transfer files from my phone to my laptop.

    I transferred files, but that was back in 2007 and did not happen now.

    Someone could please tell me a step, but no way to do this?

    Hello

    > Satellite A200 has Bluetooth?
    A200 is exactly? (A200-xxx)

    You can also check if you can see a BT tag at the bottom of the unit.
    If there is no label and then the BT module is not available and cannot be used.

  • My model have fax modem and if yes how to use this 'thing'!

    my model number is dv7-3079wm. I was told of Wal - Mart.com I could fax from my computer if I had a fax modem. I don't know if my computer has one or not. If this is the case, how I use the program and how do I know if I have analog or digital telephone lines. I would like a step by step process.

    Your laptop has a RJ-11(#5 shown in picture below) port on the right side of the laptop where you can connect the phone cable and use your laptop computer to send FAXES to others.

    Please read the guide and watch the video on how you can set up the fax on your laptop computer at the link below

    http://Windows.Microsoft.com/en-us/Windows7/set-up-your-computer-to-send-and-receive-faxes

  • How to use JavaScript to limit the number of boxes to check the user can select a PDF form?

    How to use JavaScript to limit the number of boxes to check the user can select a PDF form?

    Here's the working solution

    Please rename all the boxes like chkBox0, chkBox1... .chkBox30 (must start with 0)

    Value of exports of each checkbox must be "Yes" (default value is Yes)

    Place this Code at the level of the Javascript Document

    -Code JavaScript document-

    var counter = 0;                Checked the meter

    -Count boxes checked again when the document is closed and reopened.

    for (var i = 0; i)<= 30;="">

    If (getField("chkBox"_+_i).value == 'Yes') {}

    Counter += 1;

    }

    }

    -The function of validation-

    function validateCheckBox(name,value) {}

    If (value == 'Yes' & meter)<>

    Counter += 1;

    } else if (value == 'Off') {}

    counter = 1;

    } else {}

    getField ("name") .value = "Off";

    App.Alert ("you can select only four checkboxes");

    }

    }

    -End of Document Javascript-

    Now put this line in the MouseUp event all checkboxes

    Box - Code MouseUp event.

    validateCheckBox (event.target.name, event.target.value);

    //----------------------------------------------------------------------------------

    Hope this will help

    Kind regards

    Post edited by: Mohammad Irfan

  • Flag r-110 all-in-one: how to use the microphone internal hp r-110 all-in-one

    I know where the internal microphone, but how to use it? I always had an external mic in the past. My r-110 HP all-in-one is new so still get acquainted with it. What I need to set up the microphone and if yes, how and where. Win 10 has a configuration of mic with voice training / recgonition, but it does not show internal mic as a choice so I'm stuck! I would try to make a recording of the voice, but have no idea how activate the microphone. HELP and THANKS

    @terrib

    System is (perhaps) one of:

    Results for ' Pavillion r - 110 all in one " (51)

    Select System > product Home Page >

    Product information > category: specifications

    Form example:

    20 - r110d of HP TouchSmart all-in - One PC product specifications

    Microphone and Webcam are located at the front of the computer, along the top edge (top of the screen).

    If your taskbar contains the small speaker icon,

    Right click on the speaker icon >

    Playback devices > recording >

    Check / confirm that the "internal microphone" is selected as the default device

    You can also find the control of 'His' in:

    Control Panel > display icon > Sound

    When you see a post that will help you,

    Who inspires you, gives a cool idea,

    Or you learn something new.

    Click the 'Thumbs Up' on this post.

    My answer-click accept as Solution to help others find answers.

  • How to use Apple Watch to take weight?

    A lot of people talking about how to use Apple Watch to lose weight, but how about the point of taking weight! Does anyone know how to use Apple Watch to take weight? It can track calories from the body, not the calories to burn track!

    Thank you.

    Yes, the shows follow the calories you burn. And it's good information, no matter what you try to do it. Apple Watch is not really to lose or gain weight. His focus is on getting in shape. It is not follow the weight at all. It follows the activity. Even if you want to take the weight, you still want to be active and in good health. Consult a nutritionist for what you should eat. Download an app like MyFitness Pal, which will allow you to set a goal and track your consumption.

  • multi-angle view z liquid jade s57 camera mode (what should be done, how to use it)

    Hello

    I brought Acer and nobody seem to be able to explain to me what is the view from multiple angles in the camera.

    When I press the photo button there is a green line ranging from the left to the right, I guess so I can move around the object im taking a picture, but I don't know m.

    Only one officer of acer told me take several picture and it will merge them into one, no it's not.

    What is the multi-angle notice, how I use it and what is its role?

    From what I've seen online of other phone its supposed to do a 3d like this image when you turn the screen on the left, you see the left of the object, the same goes for when you turn the phone to the right. But I tried to take a picture while moving the camera 180 degrees around the object and its actually not not something special.

    Thank you for helping me.

    kalmeq wrote:

    From what I've seen online of other phone its supposed to do a 3d like this image when you turn the screen on the left, you see the left of the object, the same goes for when you turn the phone to the right. But I tried to take a picture while moving the camera 180 degrees around the object and its actually not not something special.

    Yes correct.

    I was able to use a picture of multi-angle using Acer abPhoto, select the picture of multi-angle, press the icon of the cube at the bottom on the left, then move your finger on the touch screen left or right, and it will move.

  • How to use outside of class in the packed library plugins

    I found the article very useful to Michael Lacasse (https://decibel.ni.com/content/docs/DOC-19176) how to use the library packaged as plugins. This approach makes the most sense when you try to distribute additional code after that your executable is already installed.

    My problem is that when I try to use a class from the main code in a plugin, plugins no longer works. Ideally, I would have liked the parent plugin interface to inherit from a class that is used in the main code, either by using the class as parameter of the plugin would be the next best thing.

    I had several mistakes, some runtime (#1448) or at the time of publishing ("VI it does not match other screws in the method: connector side terminal (s)"). I set to use clusters to transfer data to the plugins.

    My question is: is it possible to use a class defined in the main code in a packed-project-library, either inherited or as a parameter? If Yes, do you have any examples?

    It is not made with real CLASS structures, but I do the same with PPLs.

    Don't try to inherit from something in the MAIN host.

    Create the ancestor class in a separate PPL.

    Use it for the most PART, as it is.

    Inherit it in your modules.

Maybe you are looking for