5 Replies Latest reply: Apr 25, 2013 3:08 AM by jariola RSS

    Tablur form validation

    Anbarasan-Oracle
      Hi All,
      I am using APex 3.2 version and i have created Tablur form for user to Add/delete/add row etc..
      in this form i have select list Named Lov and having values 'ACTIVE' and 'INACTIVE' ...
      What is my requirement...is

      when we are adding Add row and Select values in the Select list like 'ACTIVE' OR 'INACTIVE'..
      only one 'ACTIVE' Should allow from the list..should not allow more than one..need to do validation for the Page Process...
      ---------------------
      I have tried somthing like this..but looks wrong..
      begin
      FOR ii IN 1 .. APEX_Application.g_f07.COUNT
      LOOP
      APEX_Application.g_f07(ii) := 'ACTIVE';
      END LOOP;

      IF i_count !=1 THEN

      :P2_ERROR := 'only 1 ACTIVE is possible';
      return 'only 1 ACTIVE is possible '||apex_application.g_f30(i)||' in Line '||i;

      END IF;
      END IF;
      end ;

      -------------------Please help me on this....
        • 1. Re: Tablur form validation
          jariola
          Hi,

          There is several mistakes in your code.

          - You have not declare variable i_count
          - Loop assign value 'ACTIVE' to apex_application.g_f07 array
          - Code have END IF even you have not start IF


          Regards,
          Jari
          -----
          My Blog: http://dbswh.webhop.net/htmldb/f?p=BLOG:HOME:0
          Twitter: http://www.twitter.com/jariolai
          • 2. Re: Tablur form validation
            Anbarasan-Oracle
            Hi ,
            Could you please give me the correct code...that could be help full ...
            • 3. Re: Tablur form validation
              jariola
              anbarasan wrote:
              Hi ,
              Could you please give me the correct code...that could be help full ...
              Hi,

              I think it is more helpful on long run if you try fix your code.

              Regards,
              Jari
              -----
              My Blog: http://dbswh.webhop.net/htmldb/f?p=BLOG:HOME:0
              Twitter: http://www.twitter.com/jariolai
              • 4. Re: Tablur form validation
                Anbarasan-Oracle
                Hi ,

                i have tried some thing like this...
                still i am struggling any body please give me some light up for my mind..
                -------------
                Declare
                i_count varchar2(2000);
                begin
                FOR ii IN 1 .. APEX_Application.g_f07.COUNT
                LOOP
                APEX_Application.g_f07(ii) := 'ACTIVE';
                i_count:=count(APEX_Application.g_f07(ii));

                IF i_count !=1 THEN

                :P2_ERROR := 'only 1 ACTIVE is possible';
                return 'only 1 ACTIVE is possible';

                END IF;

                end ;
                • 5. Re: Tablur form validation
                  jariola
                  Hi,

                  Create validation type function return error text.
                  And try code
                  DECLARE
                    l_err_mesg VARCHAR2(255);
                    l_count PLS_INTEGER;
                  BEGIN
                    l_count := 0;
                    FOR i IN 1 .. apex_application.g_f07.COUNT
                    LOOP
                      IF apex_application.g_f07(i) = 'ACTIVE' THEN
                        l_count := l_count + 1;
                     END IF;
                     IF l_count > 1 THEN
                        l_err_mesg  := 'only 1 ACTIVE is possible';
                        :P2_ERROR := l_err_mesg;
                        EXIT;
                      END IF;
                    END LOOP;
                    RETURN l_err_mesg ;
                  END;
                  I did not test this code so there might be mistakes. Also there might be lot of things to improve.

                  Regards,
                  Jari
                  -----
                  My Blog: http://dbswh.webhop.net/htmldb/f?p=BLOG:HOME:0
                  Twitter: http://www.twitter.com/jariolai