Single or multiple check box values displayed in a text field

My apologies, this may be a duplicate discussion.
I'm using the following script to display the values of check boxes in a text field.  I would like the word "and" to separate the values if two check boxes are selected. If more than two boxes are selected I want the values to be separated by a comma and then the last value be separated by "and".  Example of two check boxes selected:  A and B.  Example of two or more: A, B, C, and D.  Can this be done?
form1.page1.page1SF.programs::calculate - (JavaScript, client)
//displays the values of check boxes named programCB
var aChkBx = [];
var vChecks = programCB.all;
for (var a=0; a<vChecks.length;a++){
if(!vChecks.item(a).isNull) {
aChkBx.push(vChecks.item(a).rawValue);
this.rawValue = aChkBx.join(", ");

My apologies, this may be a duplicate discussion.
I'm using the following script to display the values of check boxes in a text field.  I would like the word "and" to separate the values if two check boxes are selected. If more than two boxes are selected I want the values to be separated by a comma and then the last value be separated by "and".  Example of two check boxes selected:  A and B.  Example of two or more: A, B, C, and D.  Can this be done?
form1.page1.page1SF.programs::calculate - (JavaScript, client)
//displays the values of check boxes named programCB
var aChkBx = [];
var vChecks = programCB.all;
for (var a=0; a<vChecks.length;a++){
if(!vChecks.item(a).isNull) {
aChkBx.push(vChecks.item(a).rawValue);
this.rawValue = aChkBx.join(", ");

Similar Messages

  • Single or multiple check box values displayed in a textbox

    Hi Experts!
    I'm using the following script to display the values of check boxes in a text field.  I would like the word "and" to separate the values if two check boxes are selected. If more than two boxes are selected I want the values to be separated by a comma and then the last value be separated by "and".  Example of two check boxes selected:  A and B.  Example of two or more: A, B, C, and D.  Can this be done?
    form1.page1.page1SF.programs::calculate - (JavaScript, client)
    //displays the values of check boxes named programCB
    var aChkBx = [];
    var vChecks = programCB.all;
    for (var a=0; a<vChecks.length;a++){
    if(!vChecks.item(a).isNull) {
    aChkBx.push(vChecks.item(a).rawValue);
    this.rawValue = aChkBx.join(", ");

    So, the way I see it, you actually have four scenarios. Nothing is checked, one item is checked, two items are checked, and three or more items are checked.
    Here's how I did it.
    I have four checkboxes all with the same name, cb. (You could have many more, and it wouldn't matter as long as they're all named the same thing.) I'm presuming that you will use the captions from the checkboxes as the text you want to enter. I called my text area where I enter the information tfSentence. (It's not a text field, it's just called "Text" in the Object Library.)
    //we need to count how many boxes are checked
    var checked = 0;
    for (i=0; i<=cb.length; i++){
      if (xfa.resolveNode("cb["+i+"]").rawValue == 1) checked ++;
    //create a string variable to store our sentence
    var str = "";
    //look at the checked variable and choose our case from that
    switch(checked){
      case 0:
        //you may want to do more than just type out a sentence here, like a message box
        tfSentence.rawValue = "Nothing was selected";
        break;
      case 1:
        //you can set text that will appear before your list of items here
        //str = "preliminary text";
        for (i=0; i<=cb.length; i++){
          if (xfa.resolveNode("cb["+i+"]").rawValue == 1) str += xfa.resolveNode("cb["+i+"].caption.value.#text").value;
        //you can set text to appear after your list of items here
        //str += "ending text";
        tfSentence.rawValue = str;
        break;
      case 2:
        //str = "preliminary text";
        for (i=0; i<=cb.length; i++){
          if (xfa.resolveNode("cb["+i+"]").rawValue == 1){
            if (checked == 1) str += " and " + xfa.resolveNode("cb["+i+"].caption.value.#text").value;
            else str += xfa.resolveNode("cb[+i+"].caption.value.#text").value;
            checked--;
        //str+= "ending text";
        tfSentence.rawValue = str;
        break;
      default:
        //str = "preliminary text";
        for (i=0; i<=cb.length; i++){
          if (xfa.resolveNode("cb["+i+"]").rawValue == 1){
            if (checked == 1) str += "and " + xfa.resolveNode("cb["+i+"].caption.value.#text").value;
            else str += xfa.resolveNode("cb["+i+"].caption.value.#text").value + ", ";
            checked--;
        //str += "ending text";
        tfSentence.rawValue = str;
        break

  • Update order user status based on a custom check box value in web ui

    Hi Experts,
    I have a requirement to Update the  user status based on a custom check box value in web ui.
    This is needed at the followup for a SR, the component is BT116H_SRVO, Details View.
    I created a value node with 4 checkboxes, based on the check box value, the corresponding user status
    need to be updated.
    How can I reach to the order save functionality of SAP in EH_ONSAVE method, so that syatem can capture my check box value, along with other screen fields, and append the status parameter in Order maintain?
    or do I have to call order maintain in even handler for checkbox, which will affect performance .....
    Pls help.
    Regards,
    Lakshmi

    Hi,
    In your event handler you can use bol entity corresponding to status BTStatusH and change the user status.
    Best regards,
    Caíque Escaler

  • My calculation "Total" box adds sum of all text fields whether they are visible or not, do I change

    I have check boxes that show and hide text fields. (Thanks to Gilads Java script). In options I have a default value for each text field.
    My "Total" Field field adds all fields even if they are not checked and visible. Need to have it only include them if they are checked and visible.

    You can't attach forms by email, or any other means, so it didn't come through.
    Since your fields have default values and aren't calculated based on the state of the corresponding check box, you will have to use a custom calculation script for the Total field that can check to see if any of the fields are hidden, and if so, don't include their values in the sum. For example:
    // Custom calculation script
    (function () {
        // Set up an array of field names to include in the total
        var aFields = ["text1", "text2", "text3", text4"];
        // Initialize variables
        var i, f, sum = 0;
        // Loop through the fields an calculate the sum
        for (i = 0; i < aFields.length; i += 1) {
            // Get the current field
            f = getField(aFields[i]);
            // Add the value of the current field to the sum if the field is visible
            if (f.display == display.visible) {
                sum += +f.value;
        // Set this field value to the sum
        event.value = sum;
    You can send me a PM if you want help offline.

  • Accessing check box values in to WF

    Hi guys,
    i am looping through a list to create simple table with some check boxes ( <FieldLoop for='loopvar' in='variables.apps[*]'> ). i have specified checkbox field name - as "loopvar"
    <Field name='loopvar'>
    <Display class='Checkbox'>
    <Property name='label'>
    <ref>loopvar</ref>
    </Property>
    </Display>
    </Field>
    how shud i pull / get the list of chek boxes selected on the userform in to WF? will the form return a list? and how shud be the name field syntax shud i use a ":varibales."? im confused. please guide me with the best practice to declare and access check box values
    Edited by: tea_or_kapi on Nov 20, 2009 10:44 PM

    Hi Raju,
    Try this.  Create another dataprovider within your web template?  This new dataprovider refers to a similar query, but this query definition should restrict values CG1, CG2, CG3 and CG4.  Assign this dataprovider to your checkbox.  Then make sure the properties of the checkbox affect all other dataproviders.
    Also, if this list is static, you could create an HTML checkbox object coding the options (cg1, cg2, cg3, and cg4) programmatically.  Then add javascript code to produce the proper filtering based on the users' selections.
    Let me know what happens.
    Larry

  • Multiple check boxes in an update form

    I have a database of the membership of a club. One field in the database is input by checking multiple check boxes. When the insert member record is submitted and multiple check boxes are selected, the information becomes an array of text separated by commas. When the user goes back to the update form, the check boxes are not showing checked in the appropriate fields. Please go to my test site where you will be able to see the code that I have created so far: http://www.usreboot.com/phphelp.php. You will need a user name and password to look at the update record page. Here you go: user name: wyane, password: wayne. I have submitted this request in the past and have not found success so far. Thanks for your help, Wayne Rowlands

    Thanks for getting back with me. I do have two tables. One table is the "members" table where all the information for the members is stored. One of the columns is "currentClubPositions". The database has another table which is "positions" which has the list for the positions that a member of the club could serve on. Members of the club may be serving on a number of positions at once, therefore the check boxes. Also, the club is adding and deleting positions over time, so I wanted an easy way to add them and delete them without having to go into phpmyadmin to do this. I have created a form that updates the "positions" table. The check boxes that show up in the insert member record and update member record are dynamic so that when the table "positions" changes, the forms change dynamically as do the queries to sort the database change dynamicaly. When the check boxes are entered, I use the implode function to make the values an array of text separated by commas and that value is inserted in one field of the members table named "currentClubPosition". I am all ears to hear a better way. Take a look at the web pages (see the original post) that I have created and you will see how all this ties together. Thanks, Wayne Rowlands

  • How can multiple check boxes be added at one time to a form?

    How can multiple check boxes be added at one time to a form?

    Thanks for your response, but copying and pasting creates a link. If the user places a check mark in one of the boxes, all the rest of the boxes will have a check mark also. I will research this some more.
    Carol Deatherage
    Receptionist
    Novar/Honeywell
    1000 SE 14th Street
    Bentonville, AR 72712
    Office:  (800) 341-7795
    Fax: (479) 271-0657
    [email protected]<mailto:[email protected]>
    Your feedback is important to us! Please take a moment to rate this response.
    Click Here to Access the Survey<https://www.surveymonkey.com/s/NovarSurvey>!
    This email and any files transmitted with it are confidential and intended solely for the individual or entity to whom they are addressed. If you have received this email in error destroy it immediately.
    Novar Confidential ***

  • How to insert check box value in table?

    Hi all
    kindly help me how to insert check box value in database. what code i have to use as i am new in programing.
    thanx in advance

    Hi,
    There is no "Check box" in a table, a check box is a GUI (Graphical user interface) item.
    What you want is to store a boolean value in a table. For that you can use the varchar2(1) datatype and store Y or N. (or anything else)
    (you cannot define boolean as a datatype for a column).
    If you're using a front-end application like apex then it might be useful for you to read the documentation about chekc boxes :
    http://download.oracle.com/docs/cd/E10513_01/doc/appdev.310/e10497/check_box.htm#CHDDFBFH
    (for the rest if it's Oracle Forms then everything is already said).
    Edited by: user11268895 on Aug 17, 2010 10:44 AM

  • Multiple check boxes in an update form using php

    I have a database of the membership of a club. One field in the database is input by checking multiple check boxes. When the insert member record is submitted and multiple check boxes are selected, the information becomes an array of text separated by commas. When the user goes back to the update form, the check boxes are not showing checked in the appropriate fields. Please go to my test site where you will be able to see the code that I have created so far: http://www.usreboot.com/phphelp.php. You will find the php code for the update form in a pdf file located there. You will need a user name and password to look at the update record page. Here you go: user name: wyane, password: wayne. I have submitted this request in the past and have not found success so far. Thanks for your help, Wayne Rowlands

    I am so close. If a member has only one check box checked. I get the check box checked in the update form. Here is the updated code:
    If the member has a number of check boxes checked, none of the check boxes are checked. I am so close. Maybe you can figure out what I am missing.  Thanks, Wayne

  • Fetching sub-screen check box value in module pool

    Hi,
    i hav a req in which i craeted a sub-screen in a standard sap screen QA11 using screen -exit.
    This sub-screen has two check box's for 2 approvals.I hav craeted as screen with this 2 check box and made that as a sub-screen to main screen.
    I hav few validations to be performed on these 2 check-boxes.
    1.Enabling and disabling of resp check-box based on some condition.This is happening as i hav written some logic in PBO of the screen.
    2.Validations hav to be performed on the check-box like if user clicks a check-box that value has to be captured and stored in a Z custom table.My main issue comes here.i hav written some code in PAI,but when i put a break-point,that code is not at all getting triggered.
    Kindly,let me know how can i get the check-box value from the sub-screen which is craeted in the standard screen of QA11 using screen-exit.
    Thanks in advance

    Hi,
    May be your code is written in PAI of some other screen.
    check SY-DYNNR and also use this where you are checking chekbox value.
    make sure your code is written in PAI of same subscreen
    Thanks
    Raghav M.

  • FRM-40501 Error When Attempting To Change Check Box Value

    I am getting a FRM-40501 error when attempting to update/change a check box value. There are a few factors in my form setup that could be the problem, I will list them below:
    My initial problem was that my INSERT statement would not trigger to fire (based on an IF statement) when my check box value was not initially set to the value of 'Y', even though the initial value was set to 'Y' in the property palette (value when checked was set to 'Y' and value when unchecked was set to 'N'). So, to remedy this I placed a specific literal select of 'Y' and aliased it back to the name of my check box name in the data block query, like: SELECT 'Y' CB_SELECT_SCHOOL FROM user_schools. Then I changed the check box to a database item (value to Yes when it was No before my "SQL select cheat" in the data block query). This made the initial value 'Y' and satisfied my IF statement before my INSERT statement in my trigger. However, now I can not update the check box item.
    Does anyone know a better way to satisfy the initial value of my check box to 'Y', even though in the initial value parameter for my checkbox is set to 'Y' and forms is not really setting the initial value (when the check box is not set to a database item)?
    Thanks in advance.
    Kyle

    I have fixed my issue.
    I have reverted the check box to not be a database item, removed the "SQL cheat" of selecting 'Y' aliasing my checkbox name in the datablock SQL, and changed the initial value of 'N' in the check box property palette. This will force a change by the user making the check box value of 'Y', satifying my insert when-button-pressed trigger to fire and update the selected row.

  • LOV with auto suggest and multiple check boxes

    Is it possible to implement LOV with auto suggest and multiple check boxes using ADF faces components?. Any alternative implementation/pointers are appreciated.
    Regards,
    Surya

    Hi,
    build it yourself as a task flow opened in a popup. see: http://www.oracle.com/technetwork/developer-tools/adf/learnmore/69-custom-lov-with-btf-276178.pdf
    Frank

  • How to use Multiple Check Box control  to make a list of items in check box

    I have a use case where i have to save update list of items required, and i want to implement it through viewobject and use Multiple check box control, how do i go about it? Code snippet will be helpful........
    Edited by: jDev_08 on Nov 17, 2012 8:31 PM

    Hi,
    Always mention your JDev version.
    Check out the ADF Faces Demo : http://jdevadf.oracle.com/adf-richclient-demo/faces/components/index.jspx#%2Fcomponents%2FselectManyCheckbox.jspx (Hint : Code snippet is available in there itself).
    -Arun

  • How to get data from list of values (LOV) to be displayed in a text field ?

    Hi guys,
    I am very new to Oracle APEX so please spare me if it is a silly question. How can I get the selected values from a set of list of values (LOV) displayed in a text field (or text area or so) ? Fox example, in my form I create 4 items: STATE, COUNTY, STREET, ZIPCODE and all of them are LOV (list of values). I also create 2 buttons (ADD & REMOVE). Then I create a test field (or text area name SELECTED RECORD). Now here is what I want to do with my form:
    When I set the values for all 4 fields, I will click on the ADD button then I want those values be displayed in the text field.
    For example, if the selected values are:
    STATE = Alabama
    COUNTY = Abbeville
    STREET= 1 Street
    ZIPCODE = 36310
    And the ADD button is pressed. Then in the text field I want it displays like this:
    Alabama,Abbeville,1 Street,36310
    If I choose other values and click ADD again, a new line will be added into the text fields (text area). If I click the REMOVE button, then it will clear those two line in the text field.
    Would it be possible to do it? Any help will be greatly appreciated. Thanks in advance.

    If you can live with the page being submitted and refreshed, make your ADD button do a submit with a request value of ADD and make your REMOVE button do a submit with a request value of REMOVE.
    Then create two computations (one firing with a condition of Request = ADD and the other firing with a condition of Request = REMOVE).
    In the ADD one, concatenate the values together into the text area (most likely a PL/SQL computation wiill be what you want). In the REMOVE one, set it to null with a PL/SQL computation.
    If you want it done without submitting the page, make the buttons each do a redirect to a URL but instead you will have to write two short javascript functions in the page HTML header to manipulate the field values. Each button would call each javascript function in an onclick event.

  • How to show $ sign alongwith the value in message styled text field.

    Hi,
    How to show $ sign alongwith the value in message styled text field.
    The value is coming from the table column in VO.
    I am working on OAF R12.

    Hi,
    Resolved.
    I used the below code in CO for the solution.
    Formatter currencyFormatter = new OADecimalValidater("$#,##0.00;($#,##0.00)",
    "$#,##0.00;($#,##0.00)");
    OAMessageStyledTextBean msrpField = (OAMessageStyledTextBean)webBean.findChildRecursive("MSRP11");
    msrpField.setAttributeValue(ON_SUBMIT_VALIDATER_ATTR, currencyFormatter);

Maybe you are looking for

  • How do I install the 2.0 firmware?

    I installed the itunes 7.7 update, then plugged in my iphone. Nothing pops up, so then I click the 'check for update' button and it says "The version of the iPhone software (1.14) is the current version.". How to I get the 2.0 update? Anyone know wha

  • How to open word&pdf document in the AplicationServer from Clients (Forms10

    Hi, How can in open MS Word & PDF files in the application server/any other PC in network, from the Client. I am using forms 10g. Thanks in advance. Rizly

  • Mac Pro slow start up

    I got a problem with my Mac Pro 4.1, when I turn on the mac the chime sounds after 20 - 30 secs and later on the white or gray screen appears. I had reset the PRAM, changed the coin battery, tested with the "Apple Hardware Test" (no problem at all).

  • EPS Problem

    Hello All, My client has given me .EPS file which is a web template but when I opened in photoshop it doesn't show the layer and it opened as raster file (No layers). Can someone help me how to open this file so that I can view the layers and amend i

  • How can I add a normal-sized button to my frame???

    hi, my GUI has two JScrollPane-s together in a JSplitPane and below I'd like to add a single small button. I put this button into a new JPanel, but it is displayed veeery BIG ! I tried to use .setPreferredSize(new Dimension(int, int)), but it didn't