1 2 Previous Next 23 Replies Latest reply: Jun 20, 2012 8:31 AM by 904945 RSS

    Dynamic action to change item label

    691822
      Hi All,

      How can I use dynamic action to change item label?

      thanks.
        • 1. Re: Dynamic action to change item label
          438346
          You can choose any item or event and then create a dynamic action.
          So mainly dynamic action can enable, disable items, chnage colors, show and hide items.
          I am not sure about the label. Because as I know APEX don't have a method to chnage the label of a item.

          Apex got a API called 'APEX_ITEM' and allow users to create items dynamically.


          Thanks

          * If this answer is helpfull or correct then please mark it and grant the points.
          • 2. Re: Dynamic action to change item label
            691822
            Thanks Alex, but the question was, how to use dynamic action to change item label :)
            • 3. Re: Dynamic action to change item label
              438346
              As I know APEX don't have a method to chnage the label of a item
              • 4. Re: Dynamic action to change item label
                fac586
                Why and when do you want to dynamically change a label? This would have a detrimental effect on usability and accessibility.

                Consider a visually impaired user of your app using a screen reader. The screen reader identifies a checkbox labelled "Free Cake". They like the sound of that, so navigate to the checkbox to tick it. Your dynamic action fires when it gets focus and changes the label to "Give all my money to Fadi". Hardly fair, is it?
                • 5. Re: Dynamic action to change item label
                  Luis Cabral
                  Hi,

                  I don't think there is a out-of-the-box solution for this. However, it seems that Apex 4 uses well formed label HTML elements for labels. So you could use a simple jQuery selector to get and manipulate an item's label.

                  Something like this:

                  $('label[for="P1_CUSTOMER_NAME"]').html('New label');

                  Note that sometimes there is a span nested inside the label tag.

                  You can use an "execute javascript" dynamic action type to do it.

                  Luis
                  • 6. Re: Dynamic action to change item label
                    fac586
                    You can use an "execute javascript" dynamic action type to do it.
                    Yes, you can. But should you?
                    • 7. Re: Dynamic action to change item label
                      691822
                      Hi,

                      I have a form to enter either Rent or Sale property detail, when Rent LOV selected the price column should have label Rent Per Week and when Sale LOV selected then price column should have the label Sale Price.

                      I think its fair business requirement :)

                      Thanks,
                      • 8. Re: Dynamic action to change item label
                        Luis Cabral
                        Hi,
                        fac586 wrote:
                        Why and when do you want to dynamically change a label? This would have a detrimental effect on usability and accessibility.

                        Consider a visually impaired user of your app using a screen reader. The screen reader identifies a checkbox labelled "Free Cake". They like the sound of that, so navigate to the checkbox to tick it. Your dynamic action fires when it gets focus and changes the label to "Give all my money to Fadi".
                        I think this would confuse even a sighted user! I don't know the OP full requirements or constraints but I can bet the OP does not want to change the item label when the user navigates to it.

                        I have to say that I don't like forms that change as the user enters data. I think that enabling and disabling fields is OK, but not hiding or showing or changing labels or field types.

                        In any case, if you have to do it, an alternative to changing an item label is to have 2 separate items: one hidden and one shown. Then, using some triggering event, you can hide one and show the other.

                        Because there are built-in dynamic actions to hide and show items but not to change item labels, one might thing that one approach is more acceptable than the other. However, if those 2 separate items occupy the same spot in the page, from a user point of view (or screen reader for that matter) I don't see any difference between those two approaches (in my view, both bad practices.)

                        And because of its lots of nested tables, lack of headings etc, apex pages are not screen-reader friendly anyway... This is an interesting plugin for firefox that shows how your page would be read by a screen reader:

                        http://www.standards-schmandards.com/projects/fangs/


                        fac586 wrote:
                        You can use an "execute javascript" dynamic action type to do it.
                        Yes, you can. But should you?
                        I don't know. As I mentioned above, I don't like the idea. However, as I also mentioned above, I don't know anything about the OP constraints or requirements.
                        • 9. Re: Dynamic action to change item label
                          407853
                          Create a hidden item P_label1 and P_label2
                          Based on your code populate label1 , set label2 null vice versa

                          In the label refer to the hidden item as &p_label1. &p_label2. incl the dot.

                          Hugo

                          Edited by: Hugo Perfors on May 31, 2011 7:55 PM

                          Edited by: Hugo Perfors on May 31, 2011 7:56 PM
                          • 10. Re: Dynamic action to change item label
                            TexasApexDeveloper
                            This can be done via javascript on the control.. I have done it before, to change a label when a due date is changed on an item... When the due date was changed, we change both the text and the label color...

                            Thank you,

                            Tony Miller
                            Webster, TX

                            While it is true that technology waits for no man; stupidity will always stop to take on new passengers.

                            If this question is answered, please mark the thread as closed and assign points where earned..
                            • 11. Re: Dynamic action to change item label
                              691822
                              thanks for that, I have used Dynamic action with javascript to change the label.
                              • 12. Re: Dynamic action to change item label
                                904945
                                Hi Samara,

                                I got the same requirement (Dynamic action to change item label)what you have implemented in your application.Could you please post the Javescript code you have used,that will be helpful for me to implement the same.

                                My requirement is like
                                When i select the Application name in a select list ,label of the fields should be changed depends on the name of the application.



                                Thanks & Regards,
                                Ramya.
                                • 13. Re: Dynamic action to change item label
                                  VC
                                  Hi Ramya,

                                  You may find the answer here {message:id=10386043}

                                  Thanks,
                                  Vikram
                                  • 14. Re: Dynamic action to change item label
                                    904945
                                    Hi Vikram,

                                    Thanks a lot for the response!

                                    I have put this code in the Execute when page loads section
                                    $(document).ready(function () {
                                         $("#P8_PRO_NAME").change(function () {
                                              if ($(this).val() == "HRC") {
                                                   $('#mylabel > label > span').text('Select Package');
                                              } else {
                                                   $('#mylabel > label > span').text('Element Changed');
                                              }
                                         });
                                    });
                                    and in the label section of P8_ELEMENT FIELD ,i put this line

                                    Label - Element Changed &P8_PRO_NAME.

                                    template - optional
                                    HTMl Table cell attributes - id="mylabel" 
                                    But this is not working.

                                    I have doubt here vikram like ,

                                    In the label section of the P8_ELEMENT FIELD ,what should i give??

                                    P8_PRO_NAME is a select list field.

                                    It's not working for me:(



                                    Thanks ,
                                    Ramya.
                                    1 2 Previous Next