Check whether the checkbox in a form is checked or not using javascript

when we click a check box (TBD) it should set the value of a field to a default value '1234'. If we uncheck the checkbox, it should set the field as Null.
I have defined the checkbox as STATIC2:;1234 in form.
I used the onClick event on the checkbox and called a function to update the column.
Inside the function i am checking whether the check box is checked using
if (document.getElementById('P4_TBD').checked=true)
document.getElementById('P4_COL1).value='1234';
else
document.getElementById('P4_COL1).value=''; /* or $s("P4_COL1", "");
it works only when check box is checked. If check box is unchecked it is not setting the field as Null.
I checked document.getElementById('P4_TBD').checked=false instead of else clause. it is not working.
Please help me on this issue.
Thanks,
Ravi

When you are using checkboxes or option button, the ID for your button is using an index. If you create a group of 3 checkboxes with the ID = "MY_CHECKBOXES", APEX will create the following IDs for each of your options : MY_CHECKBOXES_0, MY_CHECKBOXES_1 and MY_CHECKBOXES_2. If you want to test if the first checkboxe is checked, you'll use document.getElementById('MY_CHECKBOXES_0').checked.
I didn't test for a lone checkbox, but I expect your checkbox to be "TDB_0" not "TDB" who is the frame around your checkbox group.

Similar Messages

  • I am running Lion 10.7.2 and I have an external drive hooked to my time machine. I can't rename folders and when trying, I get an error code 8076. The checkbox "ignore permissions for this device" does not show on volume info. Help please???

    I am running Lion 10.7.2 and I have an external drive hooked to my time machine. I can't rename folders and when trying, I get an error code 8076. The checkbox "ignore permissions for this device" does not show on volume info. Help please???

    The TIme Machine volume does not have that checkbox.
    I think the issue is with your Finder...
    Go to Finder "Go" menu hold the option key and choose Library. Then go to Preferences trash these files:
    com.apple.finder.plist
    com.apple.sidebarlists.plist
    Then, restart, or log out and in again.
    (You will have to reset a few finder prefs the way you like them.)

  • Can any one tell whether the concept which i understood is correct or not

    hai everyone
    iam studying jdbc and this is what i understood about the basic concept .can any one tell whether the concept which i understood is correct or not
    whenever the statement class.forName("driver class") is executed driver class is loaded and registered with drivermanager.Internally drivr class contains a static bloc which contains the following code
    static
    Driver drv=new name of driver class();
    DriverManager.registerDriver(drv);
    whenever the statement class.forName("driver class") is executed,static bloc is executed first and driver class is registerd.
    concept as i understood about DriverManager:
    suppose there may be situations where an application developed in java has to deal with one or several databases and this is accomplished with one or different driver classes.so all these driver classes are to be managed and this is done by DriverManager class and in order to make the driver class itself known to the driver manager we have to register the driver classes with the help of registerDriver() method of DriverManager class because DriverManager is the class which will attempt to load the driver classes into memory..
    If we look at the last statement: DriverManager is the class which will attempt to load the driver classes into memory.Here i have some doubt if DriverManager class loads the driver class after registering the driver class then what does the statement class.forName("driver class") will do which is also used to loaad the driver class.
    what i understood is since the responsibility of loading the class is done by class.forName("driver class") only registering of the driver class is done as the class is alredy loaded.
    help me to clear my confusion
    thanks in advance

    hai everyone
    iam studying jdbc and this is what i understood about
    the basic concept .can any one tell whether the
    concept which i understood is correct or not
    whenever the statement class.forName("driver class")
    is executed driver class is loaded and registered
    with drivermanager.Internally drivr class contains a
    static bloc which contains the following code
    static
    Driver drv=new name of driver class();
    DriverManager.registerDriver(drv);
    }That's supposed to be the case, but there's no way to guarantee that every driver actually has that static init. I don't think I've ever run across one that doesn't, though, so, yes, you're basically correct.
    whenever the statement class.forName("driver class")
    is executed,static bloc is executed first and driver
    class is registerd.When you do Class.forName(), the class is loaded and initialized. Whenever you initialize a class, its static init blocks are executed, yes.
    concept as i understood about
    DriverManager:
    suppose there may be situations where an application
    developed in java has to deal with one or several
    databases and this is accomplished with one or
    different driver classes.so all these driver classes
    are to be managed and this is done by DriverManager
    class and in order to make the driver class itself
    known to the driver manager we have to register the
    driver classes with the help of registerDriver()
    method of DriverManager class because
    DriverManager is the class which will attempt
    to load the driver classes into memory..Except for that last part, yes.
    DM keeps track of loaded drivers, and gives them a chance to parse the connection URL when you call getConnection. DM does NOT load the driver classes into memory, however. That's done when you call Class.forName.
    what i understood is since the responsibility of
    loading the class is done by class.forName("driver
    class") only registering of the driver class is done
    as the class is alredy loaded.Right.

  • Hi, I wanted to know whether the Mac notebook model g62-b31ee install or not? Thanks

    Hi, I wanted to know whether the Mac notebook model g62-b31ee install or not?
    Thanks

    You can only install the Mac OS on Macintosh computers made by Apple.

  • Change the value of a SharePoint List lookup control value using javascript

    hi,
    could you please help in changing the value of a SharePoint List lookup control value using javascript.
    Please note that i have to change the lookup value which is in the form of a drop down from the infopath form.
    Thanks

    https://stackoverflow.com/questions/5678210/select-dropdown-menu-option-with-javascript
    Does that help?

  • I have two iPhones, one is a 4s and the other is a 3g. I have not used my 3g in some time now. I recently restored it but I cannot use it without a sim card, it says i have to "activate it."

    I have two iPhones, one is a 4s and the other is a 3g. I have not used my 3g in some time now. I recently restored it but I cannot use it without a sim card, it says i have to "activate it." I cannot place my iPhone 4s sim card in it (too small), and i do not want to get a new contract or sim card for an iPhone that i do not ues very much.

    Thanks for your help, but i cannot borrow a noral sim card now, my family has all up graded to iPhone 4s's, i have done this before, but one of my family had the same type of iphone so i could use theirs. Now i am the only one who still holds on to their old phone... I am not sure about buying an adapter...

  • Hello. How can I reset my iCloud because i forgot the password to my iCloud and I'm not using the email address i used in that account. What should I do?

    Hello. How can I reset my iCloud because i forgot the password to my iCloud and I'm not using the email address i used in that account. What should I do?

    Try this: https://iforgot.apple.com/password/verify/appleid
    Hopefully you have already set up your security questions.

  • The payment method R in country SM is not used in any company code

    Hello.
    In transaction FBZP I choose "Payment Method/Country overview"
    I open SM (San Marino) and I choose "Use in company code" I obtain the message:
    The payment method R in country SM is not used in any company code
    What have I to do?
    Thanks.
    Mario
    Edited by: Ferruccio Galli on May 7, 2009 10:41 AM
    No news for me, please?

    Hi ,
    Go through below path for confiquration patteren
    Path: SPRO  Financial Accounting  Accounts receivable and accounts payable  Business transactions  out going payments  Automatic out going payments  Payment method/ bank  selection for payment program (Transactions code: FBZP)
    set up payments method per country for payment transactions
    Set up Payment methods for company code for payment transactions
    Set up All Company codes for payment transactions:
    Set up paying company code for payment transactions:
    Bank determination:
    Regards
    Surya

  • In the supportprofile my 5s is shown with do not use

    Hi... In the Supportprofil my 5S is marked with do not use.
    Can me somebody tell me why?
    Thx

    Since your contract is not up, you would only be eligible for Early Edge.  However, a requirement of this early upgrade program is to return your current phone in good working order.  That is not possible with your situation, so you will not be able to go to Edge early.   Look at swappa for used phone at reasonable cost until your contract is over, if you can't borrow one from friends or family. 

  • HT2589 how can i skip the viewing on my account when i has not use my apple id in i tunes stores?

    How can i skip the viewing on my account when i has not use my apple id? The main problem is i do not have a credit card... so what should i do?

    You can't, you will need to enter a credit card number before you can use that account in the store.
    There are instructions on this page for how to create a new account without giving credit card details : http://support.apple.com/kb/HT2534

  • Can I hide/move a form that I am not using any longer but want to keep the template for the future?

    I would like to hide or move old forms to get the list of "My Forms" shorter and easier to manage, but don't wish to delete them. Thanks for your help!

    We also have an "Ideas" page we use to help prioritize new features, it shoulds like you would like some way to organize your forms, you might want to vote on this idea for Folders in the My Forms tab:
    http://forums.adobe.com/ideas/1587
    Thanks,
    Josh

  • Check box validation using Javascript

    Hi Everyone,
    I am using LiveCycle with my form that have multiple sections in the form that have questions that have a check box yes or  check box no next to it.  The user can either choose yes or no. Note: I am not using radio buttons.   I am looking for a Javascript function or code that when clicking a button I have set up as "regular" can check to see if a user selected either check boxes (yes) or check box (no) and validate that in that section the user has answered all question by selecting either yes or no.  Example; Section (1) has (5) questions with a yes or no check box next to each question.  I want to validate that the user selected 5 check boxes for this section (regardless if yes or no was answered for each)  if only 2 out od the 5 questions were answered with either yes or no.  I generate an error message. 
    I already have a function that searches the form and tells me how many manditory text fields have been left blank and throws an error.  I would like the check box function to be the same.  Any help would be appreciated.
    Thanks
    Jagan

    function validateCheckBox()
    if(document.TestJsp.BONUS.checked)
    return true;
    var len = document.TestJsp.BONUS.length;
    for(i = 0 ; i < len; i++)
    if(document.TestJsp.BONUS.checked)
    return true;
    return false;
    Sorry for the triple post. :=)

  • How do I clear a form text field during validation using JavaScript?

    I am just learning JavaScript and the Acrobat API.  I have a form created in adobe acrobat 9 standard (starting from an existing form in MS Excel).  There is a text field for a Social Security Number.  I have a custom format script and keystroke script and a custom validation script. I would like to add to the existing validation script, that if what is entered doesn't match the validation test, then clear out the field as in erase all the characters that were typed into the field.  I want this to happen no matter what.  So even if someone filled in a valid SSN number and then moved to the next field, but then went back to the SSN field and decided to change their entry and this new entry was "invalid" then clear out the field (do not revert to what was typed in the field originally, even though it was considered valid by the script).  (There is currently no default value for this field.)  Thank you inadvance for you help on this.
    Here is the current validation script:
    // only run when field not blank
    if (event.value != "")
    // RegExp for validation #########
    var re = /^(\d{3})(\d{2})(\d{4})$/
    if(re.test(event.value) == false)
    app.alert("Enter a 9-digit Social Security number with no spaces or special characters (e.g., 555555555). It will be converted to the format 555-55-5555.")
         //Here is where I've tried adding all of these lines, but none of them will clear out what is in the field
              //this.resetForm([event.target.name]);
              //event.target.value == "";
              //getField("SSN 1").value = getField("SSN 1").defaultValue;
              //getField("SSN 1").value == "";
              //event.rc = false;
    And incase these are somehow affecting it, here are the other scripts being processed on this field:
    Keystroke script:
    var input=event.value;
    var chars=input.length;
    if( event.willCommit || chars==8 )this.getField("Name 1").setFocus();
    Format script:
    var re = /^(\d{3})(\d{2})(\d{4})$/
    if(re.test(event.value) == true)
    // add "-"
    event.value = RegExp.$1 + "-" + RegExp.$2 + "-" + RegExp.$3;

    Thank you very much.  I did try that before, but I was using event.value == "";  I guess in this case I'm assigning the value of "", not making the value equal "".

  • How to check zobject not used recently

    HI
    I want to see all the Z development not used in last one year. We are going to upgrade from R/3 4.7 to ECC6, so i need to remove all unnecessery Z programs.
    st03n will give only 2 months back data.
    Thanks
    Gurbir Singh

    As 2 years data not possible, what I would have done is to create a report which has all the Z Programs and check with Application Team what's need and and whats junk.
    -SM

  • Yesterday was attempting to download music.my daughter used her itunes account and added the $30  i had purchased. since she had not used the account ina while she forgot the security ? and it locked us out for what the rep said would be 8 hours..

    yesterday I attempted to download music after purchasing $30 itune card from my daughters laptop..It cam to thje point where it asked 2 security questions and we were incorrect both times since she had not used it in 4 yrs..It locked us out. Had a rep call and he could not help since it was blocked. he sadi it would take up to 8 hours to go back in and we can changed the security ?s...How do I get there to do that?

    Hi FishonRB,
    Please go to your profile page for the forum by clicking on your name, and look at the top of the middle column where you will find an area titled "My Private Support Cases". There you will find a link to the private board where you and the agent may exchange information. This should be checked on a frequent basis, as the agent may be waiting for information from you before they can proceed with any actions. Please keep all correspondence regarding your issue in the private support portal

Maybe you are looking for