2

I am using Orace Apex, specifically:

SELECT
    APEX_ITEM.radiogroup(1,EMP_ACTIVE,'Y',NULL,'disabled'),
    APEX_ITEM.radiogroup(2,CUST_ACTIVE,'Y',NULL,'disabled'),
    APEX_ITEM.radiogroup(3,USER_ACTIVE,'Y',NULL,'disabled')
FROM table A;

The problem is, this statement works fine but difficult to read on the screen.

Is there another means of making this radiogroup look like a normal radiogroup, without the disabled look, in order to make it easier for the user to read but at the same time, not allowing the user to actually change the radiogroup?

halfer
  • 19,824
  • 17
  • 99
  • 186
tonyf
  • 34,479
  • 49
  • 157
  • 246

2 Answers2

2

You could selectively disable radio buttons. Disable the non-selected ones, and keep the selected one 'active'

with d as (
select 'N' emp_active, 'N' cust_active, 'Y' user_active
from dual
union all
select 'N', 'Y', 'N'
from dual
union all
select 'Y', 'N', 'N'
from dual
)
SELECT
   APEX_ITEM.radiogroup(1,EMP_ACTIVE,'Y',NULL, CASE EMP_ACTIVE WHEN 'N' THEN 'disabled' END) EMP_ACTIVE,
   APEX_ITEM.radiogroup(2,CUST_ACTIVE,'Y',NULL, CASE CUST_ACTIVE WHEN 'N' THEN 'disabled' END) CUST_ACTIVE,
   APEX_ITEM.radiogroup(3,USER_ACTIVE,'Y',NULL, CASE USER_ACTIVE WHEN 'N' THEN 'disabled' END) USER_ACTIVE
FROM d;

disabled and enabled radios

(and if i'm seeing this correct: your radio-group is vertical; only one selected within a column?)

(Idea taken from Why can't radio buttons be "readonly"?)

Community
  • 1
  • 1
Tom
  • 6,988
  • 1
  • 26
  • 40
  • Thanks Tom but unsure if this is what I am after as I can get my radiogroup to disable but the look of it is all grey and difficult to read. When you don't disable it, it stays that blue colour and easy to read, which is what I am after but still readonly. Hope this makes sense. THanks. – tonyf Jul 17 '12 at 14:29
  • Unfortunately there is no readonly attribute for the radiogroups, as you can find out in the linked question in my post. There are only workarounds or alternatives. What my code does is disable all fields that are not selected, leaving the selected option blue and thus easily spotted while not having the user able to select another option (they're all disabled). If that doesn't really do it for you, i'd look at an alternative sql statement that does not produce a radiogroup. Hope that helps. – Tom Jul 17 '12 at 14:45
  • Actually Tom, I think what you have provided is what I am after. I will give it a go. Thanks. – tonyf Jul 17 '12 at 14:58
  • Hi Tom, just wondering with your solution above, for some reason it doesn't seem to render the radiogroup buttons correctly in IE8, i.e. the 'Y' values don't display the blue dot....any ideas? FYI, I am using it on an IRR. Thanks. – tonyf Jul 18 '12 at 08:17
  • I just tested it in both FF 6.01 and IE 8, on both a classic and interactive report, with a html5 theme. I then switched to theme 20, but still the radios work as i expected. Are the radios which should be checked enabled or disabled? Could you take a look at the element html? For measure, i added a screenshot and the sql i used to test to my answer. – Tom Jul 18 '12 at 08:41
2

An alternative is to create your own icons that look like radio buttons and use them like this:

SELECT
    '<img src="' || case EMP_ACTIVE when 'Y' then 'myrg_selected.png' 
                                    else 'myrg_notselected.png' end || '"/>',
    '<img src="' || case CUST_ACTIVE when 'Y' then 'myrg_selected.png' 
                                    else 'myrg_notselected.png' end || '"/>',
    '<img src="' || case USER_ACTIVE when 'Y' then 'myrg_selected.png' 
                                    else 'myrg_notselected.png' end || '"/>'
FROM table A;

You could move the logic into a function to make the reports simpler:

SELECT
    mypkg.radio_img(EMP_ACTIVE),
    mypkg.radio_img(CUST_ACTIVE),
    mypkg.radio_img(USER_ACTIVE)
FROM table A;
Tony Andrews
  • 129,880
  • 21
  • 220
  • 259
  • 1
    Ah - that seems so much more reasonable than what i suggested. It never even occured to me! Great example of KISS. – Tom Jul 18 '12 at 09:33