This discussion is archived
7 Replies Latest reply: May 9, 2013 12:36 PM by DenverScott RSS

4.2 - Checkbox : When onClick registered for, MRU not firing (demo incl)

DenverScott Newbie
Currently Being Moderated
*** Hopefully this isn't a rehash, I've searched around but haven't found information on it. ***

I have a wizard created tabular report with a Checkbox (Y/NULL) column. The wizard also created the MRU and MRD.

In the page header, I've added the following Javascript function:

function testme(pThis){}

In the column attributes for my "Simple Checkbox", I added the follow to "Element Attributes":

onClick="testme(this);"

With this in place, when I click/unclick the checkbox and submit for a save using the MDU, the changed state of the checkbox is not saved to the database. Also, any new records (via new row) are added with a NULL for the checkbox field regardless of what is selected during creation.

If I change "Element Attributes" to:

onChange="testme(this);"

Then the MDU works just fine. Only reason I'm worried about this is that I understand onChange can be problematic on certain IE versions.

Thanks,
Scott
  • 1. Re: 4.2 - Checkbox : onClick Vs. onChange
    Howard (... in Training) Pro
    Currently Being Moderated
    Scott,

    Have you looked at these for insight into the difference?

    1) {thread:id=2486549} QUOTE: "Checkboxes generate differing HTML from the usual text field ... Checkbox HTML consists of HTML for the checkbox and a hidden item."

    2) http://stackoverflow.com/questions/4471401/getting-value-of-html-checkbox-from-onclick-onchange-events

    3) http://www.nofluffjuststuff.com/blog/scott_leberknight/2005/04/onclick_versus_onchange_in_ie_and_firefox
    QUOTE: "Here's what the HTML 4.01 specification has to say about onchange event handlers: "The onchange event occurs when a control loses the input focus and its value has been modified since gaining focus. This attribute applies to the following elements: INPUT, SELECT, and TEXTAREA."

    Regards,
    Howard
  • 2. Re: 4.2 - Checkbox : onClick Vs. onChange
    DenverScott Newbie
    Currently Being Moderated
    Yeah, I looked at the first one you have listed there and it is talking about a different issue. The display actually works fine with regards to "onClick", until you submit for a save/update on the records. The save/update MDU doesn't manage the checkbox, it's value never changes. However, all other columns for the record are fine.

    Thanks,
    Scott
  • 3. Re: 4.2 - Checkbox : onClick Vs. onChange
    Howard (... in Training) Pro
    Currently Being Moderated
    Denver,

    Can you get an account on apex.oracle.com and construct the most trivial example that shows what you have described? Then set up a developer account to give folks developer access. That usually gets more folks interested in helping. They have something they can get their hands on.

    Howard
  • 4. Re: 4.2 - Checkbox : onClick Vs. onChange
    DenverScott Newbie
    Currently Being Moderated
    Howdy Howard (and others) -

    I was hoping someone would have an answer without generating an example, but I hi-jacked the demo and came up with one:

    http://apex.oracle.com/pls/apex/f?p=70849:9:16222360984434:::::

    Workspace: DenverScott
    UserName: Test_User
    P/W: Test123
    Page: 9

    Recreate Problem: Change the checkbox value of an item under OnChange and OnClick and press "Submit", only OnChange items actually change.

    On this report, the two columns "OnChange" and "OnClick" are the focus. They are both simple check boxes and basically have the same settings. They both call an empty javascript function "test_me(this)" when clicked. Difference is, the MRU works for the "OnChange" column, updates are applied. You can change the "Onclick" column and submit all you want and it does nothing.

    If you remove the event for OnClick="test_me(this);" from the "OnClick" column, the submit/updates work just fine.

    (If anyone changes the demo, please return to prior state for others to examine)

    Thanks,
    Scott
  • 5. Re: 4.2 - Checkbox : onClick Vs. onChange
    Howard (... in Training) Pro
    Currently Being Moderated
    Denver,

    Nice example!

    I suppose you have thought of this: Can the two OnClick calls be interfering?

    </td><td  headers="URL"  ><label for="f06_0000" 
    class="hideMeButHearMe">OnClick </label><input type="checkbox" 
    name="f06_NOSUBMIT" value="STATIC=Y" 
    -->onClick="test_me(this);" id="f06_0000_01" 
    -->onClick="if (this.checked) {apex.jQuery('#f06_0000').val('STATIC=Y');} 
    else {apex.jQuery('#f06_0000').val('');}" /><input type="hidden" 
    name="f06" value="" onClick="test_me(this);"  id="f06_0000" /></span><
    Howard
  • 6. Re: 4.2 - Checkbox : onClick Vs. onChange
    DenverScott Newbie
    Currently Being Moderated
    Yeah, the two calls interferring is the only logical thing I could think of ... but I just don't see how I could be the first to hit this. I seems like I'm trying to do something that would be pretty basic.
  • 7. Re: 4.2 - Checkbox : onClick Vs. onChange
    DenverScott Newbie
    Currently Being Moderated
    Just bouncing up to the top again in case anyone has an ideas. Thanks.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points