9 Replies Latest reply: Dec 3, 2013 9:10 AM by VANJ RSS

    Tabular form validation - Read non-editable column

    VANJ

      APEX 4.2.2

       

      Tabular form validation - Row level. It appears that the validation code has access to just the editable fields on the row (i.e. text fields, select list, radio button, etc) using :COLUMN_NAME notation. But what if I want to validate a value based on the value of another column that is not editable? i.e. CURRENT_STATUS is a readonly field on the row. NEW_STATUS is a select list. The validation should check that CURRENT_STATUS is not the same as NEW_STATUS. It doesn't raise an error when I refer to :CURRENT_STATUS in the "Function returning error text" validation but it doesn't work.

       

      Help? Thanks

        • 1. Re: Tabular form validation - Read non-editable column
          Nicolette

          VANJ

           

          What is the display type of CURRENT_STATUS?

          If it isn't Display as Text(saves state) try that first.

           

          If the state isn't saved the value on the screen isn't available on the server after submit.

          And the validation happens after submit on the server.

           

          Nicolette

          • 2. Re: Tabular form validation - Read non-editable column
            VANJ

            The Display Type of CURRENT_STATUS is Display as Text (Based on LOV, does not save state). It has to be that type because I need to translate values 1,2,3 to more meaningful descriptions based on a LOV (the same LOV used for the NEW_STATUS select list)

             

            I guess what need is a display type Based on LOV, DOES save state. :-(


            Any other suggestions?

            • 3. Re: Tabular form validation - Read non-editable column
              ediazjorge

              VANJ,

               

              One suggestion that comes to my mind is to select the column CURRENT_STATUS twice in your query an assign two different alias, e.g.:

               

              CURRENT_STATUS_DISPLAY  - Display as Text (Based on LOV, does not save state)

              CURRENT_STATUS_SAVE_ST - Display as Text (saves state)

               

              Set “Show Column” = “No” for CURRENT_STATUS_SAVE_ST and use this column to compare the NEW_STATUS.

               

              I haven't test this approach but hopefully this works for you.

               

              Thank you,

               

              Erick

              • 4. Re: Tabular form validation - Read non-editable column
                VANJ

                I tried this with both Show Column = No and Display as = Hidden but looks like unless the column is actually rendered on the page and therefore submitted for processing, the APEX engine does not make it available to the validation code using :COLUMN notation.

                 

                What I ended up doing was very similar to what you suggest. I selected the column twice, once as Display as Text (Based on LOV, does not save state) and again as "Text Field" and added a Javascript snippet in the Region Footer to hide the latter column when the page is rendered.

                 

                Not very elegant, but it seems to be working.

                 

                <script>
                $("td[headers='CURRENT_STATUS_SAVE_ST']").css("display","none");
                $("th#CURRENT_STATUS_SAVE_ST").css("display","none");
                </script>
                

                APEX team: Are we missing something? Why not make the value of ALL tabular form columns available to after-submit Validation code using :COLUMN_NAME notation? Thanks

                • 5. Re: Tabular form validation - Read non-editable column
                  Nicolette

                  VANJ

                   

                  Did you try with Show column=Yes and Display as =Hidden.

                  This would create a hidden item that is present in the last column of your tabular form. Meaning that query columns with display type hidden don't get there own column in the generate html table.

                   

                  You wouldn't need the javascript in that case.

                   

                  As for not submitting column values for columns with a "don't save state" display type. That is the exact same behaviour as for page items with the same display type.

                   

                  Nicolette

                  • 6. Re: Tabular form validation - Read non-editable column
                    VANJ

                    Nicolette - Yes, I did try Show=Yes, Display=Hidden, did not help. The validation code did not have access to the value of the column using :COLUMN notation, it was always NULL.

                     

                    APEX team: Are we missing something? Why not make the value of ALL tabular form columns available to after-submit Validation code using :COLUMN_NAME notation? Thanks

                    • 7. Re: Tabular form validation - Read non-editable column
                      Marc Sewtz

                      I think what would help in this case is in fact adding a display type "Based on LOV, DOES save state". We can only include session state for columns that actually submit data, i.e. form items incl. hidden items. If it's a display-only item, that does not save state, it won't be available on the sever - as was pointed out earlier in this thread. I'll take a note to consider adding "Based on LOV, DOES save state" for APEX 5.0, and would encourage you to also include this request in our feature request application at:

                       

                      http://apex.oracle.com/vote

                       

                      Regards,
                      Marc

                      • 8. Re: Tabular form validation - Read non-editable column
                        VANJ

                        Marc - Thanks for jumping in. Yes, adding a "Based on LOV, DOES save state" display type would help.

                         

                        Actually, Nicolette's suggestion to "Show column=Yes and Display as =Hidden" also works, I didn't test it correctly. Couple of minor display issues: a) on the Report Attributes page, even when the Show Column checkbox is checked for a Display as Hidden column, it is ignored when the page is saved and refreshed. Of course, this is a moot point since the column is not displayed on the page but it is odd to allow the box to be checked and then uncheck it. b) On the Edit Validation page (4000:4316), there is a Tabular Form Columns region shown in the right sidebar. This region does NOT include Display as Hidden columns even though they are indeed available for use in the validation code. Checking the report query shows that it excludes the following display types: WITHOUT_MODIFICATION,, TEXT_FROM_LOV, ESCAPE_SC, HIDDEN, CHECKBOX. I think the last 2 are editable item types that are part of the page submission and should be listed on the report as available.

                        • 9. Re: Tabular form validation - Read non-editable column
                          VANJ

                          Sorry, one more enhancement request while we are on the topic...Validation error messages list the error message followed by the row number e.g. If Column A = 5, Column B cannot be 10 (Row 12). It would be helpful if Row 12 is a hyperlink that puts cursor focus on the first editable field in that row, similar to page item validations (and tabular form column-specific validations). At the very least, there should be an option to show row numbers on each displayed row so it is easy to locate the row that has the error. Yes, we can do this ourself by including the substitution string '#ROWNUM#' in the report query and but it would be nice to be able to do it declaratively.

                           

                          Thanks