3 Replies Latest reply: Oct 17, 2013 3:02 PM by vincent_deelen RSS

    Display Only and Dynamic Actions

    DBPereira

      Is there any way to manipulate a Display Only Item using dynamic Actions, and set "Save Session State" to "Yes", so that the information be regularly saved when the form is submitted?

        • 1. Re: Display Only and Dynamic Actions
          vincent_deelen

          Hi,

           

          There are a few ways to populate display only values and save them. One simple and effective way is to populate them from a select list. The Skill Builders Super LOV is very effective for that, since it lets you map items from a list of values to one or more page items.

          You can get the plugin here: - Item Plugin - SkillBuilders Super LOV

          The plugin is well documented, so installling it shouln't be a problem.

           

          Another way to set display only items is by using javascript or jquery to populate the display only item. Yet another way is to use an AJAX call to populate the field, and lastly you can also you pl/sql to set the session state of the display only item, although it might be a bit more difficult to get the item displayed before submitting and reloading your page.

           

          In short, there are various ways to set a display only item, perhaps you can explain what it is that you want to do, ie what kind of item do you want to set and how do you plan to determine what the value of the item should be. Also can you tell what version of APEX you use?

           

          Kind regards,

           

          Vincent

          • 2. Re: Display Only and Dynamic Actions
            DBPereira

            I got a Display Only text field that is set by a Dinamic Action with the &APP_USER. after another field is set by the user.

            The problem is that when this  Display Only item with Dinamic Action, everything occurs ok, but when I try to apply changes, I receive a error message: "Session state protection violation: This may be caused by manual alteration of protected page item P9_INICIO_PRE_USUARIO. If you are unsure what caused this error, please contact the application administrator for assistance"

            If I set "Save Session State" to NO the error doesn't happens, but the data isn't saved.

             

            Apex version. 4.2.3.00.08

            • 3. Re: Display Only and Dynamic Actions
              vincent_deelen

              Hi,

               

              Okay that's a common problem. The display-only attribute doesn't let you save the item, What you can do is render the item as a normal text field and then put the following in your region header:

               

              <script>

              $('# P9_INICIO_PRE_USUARIO').attr('readonly',true).css('background-color','#C0C0C0')

              </script>

               

              This will make a read-only field of your page item. Read only is not enterable by the user, but is submitted to the database. The .css part at the end is to give the textfield some shading, to let users now the field is not enterable.

               

              Note however that this is not a secure practice: you can easily alter the field value from your browsers console, for example. To ensure you store correct data in your database you still should use some pl/sql validation or process.

               

              Kind regards,

              Vincent