5 Replies Latest reply: Jun 27, 2013 12:58 AM by paavo RSS

    Highlight text field in tabular form after validation

    Martina1018
      Hi everyone,

      one of my apex pages has a tabular form querying a database view. The tabular form has one column that is editable by end users (displayed as a popup lov).
      The user should only enter values that already exist in another table (e.g. an employee can only work in a department that exists).
      If this is the case then an instead-of trigger inserts the updated fields to the underlying table.
      I tried to validate the user inputs via the standard tabular form validation but that failed because the tabular form is based on a view and returned the typical error ORA-01445: cannot select ROWID from, or sample, a join view without a key-preserved table.
      So now I'm validating the fields with the page level validation and a Plsql function. What I still haven't achieved is the functionality to highlight the text fields which produced an error.

      I already tried something like this
      [http://tylermuth.wordpress.com/2007/12/01/conditional-column-formatting-in-apex/]
      or like this
      Highlight field in Validation Routine
      but nothing seemed to work.

      I do not want to show the validation message in a popup (Validation error message in popup
      I reproduced my current situation in the workspace below. Any ideas how to solve the issue?
      Thanks.
      ______________________
      Demo Application:
      WORKSPACE: VAL_HIGHLIGHT
      SCHEMA: DEMO_USER
      PASSWORD: highlight

      APEX Version: 4.2.2
      Database Version: Oracle Database 11g Enterprise Edition Release 11.2.0.2.0.
        • 1. Re: Highlight text field in tabular form after validation
          paavo
          I am glad that you raised this issue to the forum because I am also struggling with the same challenge of not being able to make validations for form columns over complex joined view.

          I tried to find answers from here:
          [http://www.apex-at-work.com/2012/12/apex-41-tabular-form-ora-01445-cannot.html]
          v4.0 - Tabular form ORA-01445: cannot select ROWID from, or sample,

          and found out that If the declarative validations are removed the instead of triggers work. which is of course something, but surely not an answer..


          rgrds Paavo
          • 2. Re: Highlight text field in tabular form after validation
            paavo

            Said:

            and found out that If the declarative validations are removed the instead of triggers work. which is of course something, but surely not an answer..

            Lets hope there will be way to enable the validations for tabular forms over views,

             

            /rgrds Paavo

            • 3. Re: Highlight text field in tabular form after validation
              paavo

              Made feature request = Feature AGDQ - Extend tabular form wizard to support views with instead of triggers

               

              /rgrds Paavo

              • 4. Re: Highlight text field in tabular form after validation
                Tom Petrus

                Does the view have a sort of unique identifier per row? What if you create one, like for example use the concatenated ID fields of 2 joined tables? Wouldn't that work?

                 

                As for page level validations: one idea might be to put out some JSON instead of plain text. With jQuery you could pick up the message and get the json structure out. You could then parse it and loop through it, creating messages to be displayed both on top and next to a defined item.

                For example, with an output like this:

                [{"column":"DEPTNO","row":"5","message":"You selected an invalid department!"},{"column":"DNAME","row":"6","message":"This name does not exist!"}]

                 

                Not all that spectacular, but if you want to get this working this could probably help.

                • 5. Re: Highlight text field in tabular form after validation
                  paavo

                  Thank you for trying to help.

                  TomPetrus wrote:

                   

                  Does the view have a sort of unique identifier per row? What if you create one, like for example use the concatenated ID fields of 2 joined tables? Wouldn't that work?

                  The complex joined view with instead-of-triggers must have key-preserved tables and it helps to have such concatenated key, but it doesn't solve the problem of auto-generated validations bombing in the newly created tabular form.

                   

                   

                  As for page level validations: one idea might be to put out some JSON instead of plain text. With jQuery you could pick up the message and get the json structure out. You could then parse it and loop through it, creating messages to be displayed both on top and next to a defined item.

                  For example, with an output like this:

                  [{"column":"DEPTNO","row":"5","message":"You selected an invalid department!"},{"column":"DNAME","row":"6","message":"This name does not exist!"}]

                   

                  Not all that spectacular, but if you want to get this working this could probably help.

                  It looks like you have made solution which can validate input in tabular form, any possibility to have example in apex.oracle.com    ?

                  I think Martina1018 adds even more spice to this challenge with the need to highlight based on the validation results.

                   

                  rgrds Paavo