14 Replies Latest reply on Jul 30, 2013 4:30 AM by Gaurav Nagpal

    Read Only Checkbox

    Alexandra Robin
      How can I make a read-only checkbox a little more visible than the default very-grayed out display? I realize greyed out is pretty much a default way to inactivate the checkbox, but the user wants to be able to see it.
      Thanks in advance.
        • 1. Re: Read Only Checkbox
          How can I make a read-only checkbox a little more visible than the default very-grayed out display?
          You mean a disabled checkbox. Apparently there is no such thing as a read-only checkbox. (If you don't know why Ian Hickson's opinion should be authoritative on this point, try Google...)
          I realize greyed out is pretty much a default way to inactivate the checkbox, but the user wants to be able to see it.
          The user wants to see a checkbox or the user wants to see the value it represents?

          A disabled checkbox appears the way it does to encourage users to ignore it: there's no point in clicking it; it's not going to be submitted. If they can't modify this value, is there any point in it being rendered as a checkbox control? The user can't control it in any way. If it looked like a "normal" checkbox what does the user think when they dementedly click it 40 times and nothing happens? (See +{thread:id=2218136}+ for a similar discussion)

          If we're talking about a value that is sometimes rendered as a checkbox, but that for some reason the user is currently unable to modify, we can use the Read-Only property to render the value as plain text, or conditions to hide the checkbox and display an alternative rendering (such as a big green tick image)...
          1 person found this helpful
          • 2. Re: Read Only Checkbox
            Alexandra Robin
            All your comments known and understood and why I was reluctant to shoot off this thread. I apolgize for not taking more time to let you know I knew. But it's a matter of re-educating users vs. making things look the same as they always did but function appropriately. This is a form in which I've made ALL fields read-only because I'm trying to find an quick and easy way to print it out so that our purchasing department can send it out to our supplers. I don't want the value to display as 'Yes,' so I'll play around with other options.
            • 3. Re: Read Only Checkbox
              Adding on to Paul's comments , You could always hide the checkbox,use a styled span element(or an image itself) which check's or unchecks the hidden checkbox while toggling the image for checked status. For cases where it is read only you can conditionally remove the event handler

              Here's an example page(I copied the image and style settings from here
              The code is quite straight forward
              SELECT    '<span onclick="$(this).toggleClass(''checked'');$(this).siblings().trigger(''click'')"class="checkbox" > </span>'||
                              apex_item.checkbox(1,empno,'style="display:none"') empno
              FROM emp
              And the CSS styling used is
                  span.checkbox {
                      -moz-background-clip: border;
                      -moz-background-origin: padding;
                      -moz-background-size: auto auto;
                      background-attachment: scroll;
                      background-color: transparent;
                      background-image: url(&quot;#WORKSPACE_IMAGES#checkbox.png&quot;);
                      background-position: 0 0;
                      background-repeat: no-repeat;
                      clear: left;
                      display: block;
                      float: left;
                      height: 25px;
                      padding-bottom: 0;
                      padding-left: 0;
                      padding-right: 5px;
                      padding-top: 0;
                      width: 19px;
                  span.checked {
                      background-position: 0pt -50px;
              If you want to make the checkboxes conditionally readonly, it isn't much different either
              SELECT    '<span '||case when sal > 1000 then 'onclick="$(this).toggleClass(''checked'');$(this).siblings().trigger(''click'')"' end||' class="checkbox" > </span>'||
                              apex_item.checkbox(1,empno,'style="display:none"') empno
              FROM emp
              uses salary  greater than 1000 as a criteria to make the record's checkbox image readonly
              • 4. Re: Read Only Checkbox
                Alexandra Robin
                Solved...just gave the checkboxes administrator permissions.
                • 5. Re: Read Only Checkbox
                  Gaurav Nagpal

                  Hello Alex, Could you explain how you gave the check box administrator permissions??? Regards, Gaurav Nagpal.

                  • 6. Re: Read Only Checkbox
                    Alexandra Robin

                    Hi Gaurav -

                    I'm not sure how secure this is but...


                    • I have an EMPLOYEES table and created fields I used as flags for each role I needed, i.e., CREATE, APPROVE, ADMIN, CUST_SVC, etc.
                    • I created a form to input emplyees










                    • I created a DOC_ROLES table with an FK on the EMPLOYEES table








                    ADMIN_ROLE (note: "ADMIN" is a reserved word, so I added 'ROLE' to this field name)

                    USERNAME (I had to bring this over from the EMPLOYEE table to link to APP_USER


                    • In the application itself, I went to Shared Components > Authorization Schemes, and created the following for each role:

                    select 1 from ROLES

                    where UPPER(username) = v('APP_USER')

                    and CREATES = 'Y'


                    And then....

                    • Everything for which I needed to apply a role, I went to Authorization Scheme for that region, item, etc. and chose the role.


                    Make sense?

                    • 7. Re: Read Only Checkbox
                      Gaurav Nagpal

                      Hello Alex,

                      Yes,it make sense and thank as well for explaining the scenario.


                      but what I am looking for is, making check read only so that end user cannot checked and unchecked my check box/flag for that i wrote sql like this but i do not which option, I should in apex which restrict the check box from end user


                      1. SELECT ta.EMPNO ,apex_item.checkbox(2,ta.test_flag,decode(ta.test_flag,'N','UNCHECKED','CHECKED')) AS flag from emo ta

                      2.Display as        -> standard report column.

                      3.Element attribute -> class="checkbox" DISABLED


                      Unfortunately, I am not able to complete the excepted result.       


                      Any suggestion are welcome !!!!


                      Regards, Gaurav Nagpal.

                      • 8. Re: Read Only Checkbox
                        Alexandra Robin

                        It may be easier than you think.  Click Show Edit Links click on the link for that checkbox. One of the sections is "Read Only."  You can click on the Read Only link at the top of the page or just scroll down to it.  Select "Always" and you've done it!

                        • 9. Re: Read Only Checkbox
                          Gaurav Nagpal

                          Hello Alex,


                          I checked, but unfortunately I did not get  "One of the sections is "Read Only" option .

                          It would be good if you can share the step by step process or with navigation.


                          Thank you.

                          Regards, Gaurav Nagpal.

                          • 10. Re: Read Only Checkbox
                            Alexandra Robin

                            I add checkboxes using the ADD ITEM section on the edit page. If your checkbox is in an interactive report, open that item in the list. Once I'm in the "Edit Page Item" of the checkbox, I scroll down to the Read Only section (just below the Conditions section) and select "Always" in the Read Only section. On what kind of page do you have checkboxes?  A form? A tabular form?

                            • 11. Re: Read Only Checkbox
                              Gaurav Nagpal

                              Hello Alex, I  have  a check box on SQL report region.


                              May be the reason, I am not getting above options mentioned by you?


                              Thanks & Regards,

                              Gaurav Nagpal.

                              • 12. Re: Read Only Checkbox
                                Gaurav Nagpal

                                Hello alex,

                                Issue resolved with below query

                                SELECT ta.EMPNO ,APEX_ITEM.CHECKBOX

                                                                                (p_idx  => 8,       

                                                                                p_value => ta.flag,

                                                                                p_attributes => 'disabled="disabled"',

                                                                                p_checked_values => 'J',

                                                                                p_item_id => 'f08_'||ta.id  ) AS check box

                                  FROM from emp ta


                                Regards, Gaurav Nagpal

                                • 13. Re: Read Only Checkbox
                                  Alexandra Robin

                                  Great job!! I'm afraid my knowledge base keeps me designing with wizards. Have an excellent week. Alex

                                  • 14. Re: Read Only Checkbox
                                    Gaurav Nagpal

                                    Thank you Alex for your continue support.