8 Replies Latest reply: May 14, 2012 6:41 PM by fac586 RSS

    variable for radio group label

    wcoleku
      Hi all,

      I'm having an issue with radio group labels.

      If I enter
      <table style="border:0px;"> <tr> <td style="text-align:right;padding:2px 8px 1px 0px; font:12px/16px Arial,sans-serif;">No Election</td> </tr> </table>
      in the field for the radio group label I get correct output.

      No Election

      If I place the above string in a variable, say P10_LABEL, and place &P10_LABEL. in the field for the radio group label, I get the actual html code instead of the text I'm expecting.

      I can not just hard code the value iin the field because it is calculated in a before header process (meaning there could be more that 1 table row).

      Does any one have any suggestions that might help?

      I'm on version Application Express 4.1.1.00.23

      Thanks
      Wayne
        • 1. Re: variable for radio group label
          fac586
          wcoleku wrote:

          If I enter
          <table style="border:0px;"> <tr> <td style="text-align:right;padding:2px 8px 1px 0px; font:12px/16px Arial,sans-serif;">No Election</td> </tr> </table>
          in the field for the radio group label I get correct output.
          What exactly are you trying to achieve with this HTML?
          I can not just hard code the value iin the field because it is calculated in a before header process (meaning there could be more that 1 table row).
          Can you expand on that?
          Does any one have any suggestions that might help?
          I'd be trying to accomplish this (whatever it is) using the standard APEX-generated mark-up and pure CSS.

          Suggest you produce an example on apex.oracle.com that incorporates whatever use cases are necessary.
          • 2. Re: variable for radio group label
            VC
            Until you find a clean solution,just use this jquery code to as workaround

            Edit the radio group > Label > HTML Table Cell Attributes > give an id="PX_ITEM_NAME_LABEL"

            create a dynamic action on page load to execute the below javascript
            $('#PX_ITEM_NAME_LABEL').children('label').html(unescape($('#PX_ITEM_NAME_LABEL').children('label').text()));
            • 3. Re: variable for radio group label
              wcoleku
              demo is at http://apex.oracle.com/pls/apex/f?p=37038:1

              Working is using hard coded html in label field
              Non working is using a variable in the label field.

              Thanks for the help

              Wayne


              Edit this was posted for fac586. Hit the wrong reply link.

              Edited by: wcoleku on May 14, 2012 3:02 PM
              • 4. Re: variable for radio group label
                wcoleku
                demo is at http://apex.oracle.com/pls/apex/f?p=37038:1

                Working is using hard coded html in label field
                Non working is using a variable in the label field.

                Thanks for the help

                Wayne
                • 5. Re: variable for radio group label
                  wcoleku
                  Thanks VC,

                  Don't know if there is a cleaner solution than the one that you provided. I tried your suggestion and it works nicely. I've put what I'm trying to do at url: http://apex.oracle.com/pls/apex/f?p=37038:1, if you are trying to see what I'm actually doing.

                  Thanks again
                  Wayne
                  • 6. Re: variable for radio group label
                    fac586
                    What are you actually trying to achieve here? I'm afraid that initially it doesn't make much sense to me. I'm guessing that this is either:

                    1. A dynamic many:many label for the radio group options. This I've never seen before and wonder why you'd want to do it?

                    OR

                    2. An attempt to provide further labels on a 1:1 basis for a dynamic radio group.

                    Could you back up a bit and explain what you're trying to do here and why?
                    • 7. Re: variable for radio group label
                      wcoleku
                      Basically what I'm attempting to do is provide more descriptive text for a radio group.
                      Something along the lines of
                      Plan                Cost
                      _______________    ________
                      Plan 1             0 $1.00
                      Plan 2             0 $2.00
                      Plan 3             0 $3.00
                      Plan 4             0 $4.00
                      Plan 5             0 $5.00
                      No Plan            0 $0.00
                      Where the Cost is the actual lov with text and return value and Plan is the label. Needed a way to be more specific. Just adding text to the lov, there by making it look like, see below, doesn't look as nice (very subjective, I know) as above.
                      <p>
                      Plan and cost
                      _________________
                      0 Plan 1 - cost $1.00
                      0 Plan 2 - cost $2.00
                      0 Plan 3 - cost $3.00
                      0 Plan 4 - cost $4.00
                      0 Plan 5 - cost $5.00
                      0 No Plan- cost $0.00
                      </p>

                      Hope this explains what I'm doing better.

                      Please do not take this the wrong way because I really do appreciate the time and effort you have taken to help me , but does it really matter why I want to do this versus I need a variable to contain an html string that I want to display in a label (shouldn't matter what the string is, for example it could be something as simple as
                      <strong>label_text</strong>
                      one time and just label_text the next depending on some condition) and I how do I go about it getting it to display correctly?

                      Thanks again for your help
                      Wayne
                      • 8. Re: variable for radio group label
                        fac586
                        wcoleku wrote:
                        Basically what I'm attempting to do is provide more descriptive text for a radio group.
                        Something along the lines of
                        Plan                Cost
                        _______________    ________
                        Plan 1             0 $1.00
                        Plan 2             0 $2.00
                        Plan 3             0 $3.00
                        Plan 4             0 $4.00
                        Plan 5             0 $5.00
                        No Plan            0 $0.00
                        Where the Cost is the actual lov with text and return value and Plan is the label. Needed a way to be more specific. Just adding text to the lov, there by making it look like, see below, doesn't look as nice (very subjective, I know) as above.
                        <p>
                        Plan and cost
                        _________________
                        0 Plan 1 - cost $1.00
                        0 Plan 2 - cost $2.00
                        0 Plan 3 - cost $3.00
                        0 Plan 4 - cost $4.00
                        0 Plan 5 - cost $5.00
                        0 No Plan- cost $0.00
                        </p>

                        Hope this explains what I'm doing better.
                        Thanks for taking the time to do so.
                        Please do not take this the wrong way because I really do appreciate the time and effort you have taken to help me , but does it really matter why I want to do this versus I need a variable to contain an html string that I want to display in a label (shouldn't matter what the string is, for example it could be something as simple as
                        <strong>label_text</strong>
                        one time and just label_text the next depending on some condition) and I how do I go about it getting it to display correctly?
                        Because there's more to this HTML caper than just splattering text and angle brackets across a page and reaching for the jQuery duct tape when it doesn't stick.

                        At best what you're attempting to do results in invalid HTML that isn't compliant with the specification. At worst you or your customer could end up in court defending a disability discrimination suit.

                        The HTML specs don't allow for the item <tt>label</tt> to contain a <tt>table</tt>. The content model for the <tt>label</tt> element is:
                        >
                        Phrasing content, but with no descendant labelable elements unless it is the element's labeled control, and no descendant label elements.
                        >
                        Phrasing content doesn't include <tt>table</tt>.

                        More importantly, even if you can get your current browser to provide what you consider an acceptable visible rendering of this invalid structure, where you know what that layout means, that's not the case for all user agents and users. In a non-visual device&mdash;say a screen reader or refreshable 1-line Braille display&mdash;there would be no tangible relationship between the content of the Plan <tt>label</tt> and the radio buttons[1]. Such devices produce a serialized representation that will output all of the Plan table before any of the radio button options.

                        The correct representation is something like
                        (o) Plan 1  - $1.00
                        ( ) Plan 2  - $2.00
                        ( ) Plan 3  - $3.00
                        ( ) Plan 4  - $4.00
                        ( ) Plan 5  - $5.00
                        ( ) No Plan - $0.00
                        with valid <tt>label</tt>s generated through the LOV. It should still be possible to achieve your desired visual layout using CSS from valid HTML here, but like you I come unstuck on Oracle's insistence that we can't generate HTML in LOV labels&mdash;Encoded special characters in select lists in APEX 4 notwithstanding.

                        My preference is to start with valid HTML, and then go to work on it with CSS and jQuery to get the required rendering. And raise hell will Oracle when APEX won't let you.

                        [1] APEX does bad things here too. For a checkbox/radio group default themes generate a <tt>label</tt> for the enclosing <tt>fieldset</tt>, but <tt>fieldset</tt>s are not labelable elements. (Although it is possible to stay valid using a counterintuitive Label template that doesn't include a <tt>label</tt> element...)