6 Replies Latest reply: Jul 3, 2013 12:21 PM by The Learner RSS

    alert-fields should not be empty

    The Learner


      I am using Oracle forms 10g,


      My question is...


      in form.. If i left some required items empty... when I press submit button then it should display alert message these fields(like empno,ename,sal,..) are empty....

      please  fill these items....


      help me...



        • 1. Re: alert-fields should not be empty



          Are you working with oracle forms or Oracle EBS ?



          If Form then


          First Create a Alert with the following properties and message to display

          Alert_name is Test


          In the when-button-pressed  trigger write the code


          IF :Block.your field_name(Empno) or :Block.Ename or :block.Sal is null then


          Show_alert ('your alert_name');




          Your Code.


          End if;



          Thanks & Regards


          • 2. Re: alert-fields should not be empty
            The Learner



            I am using Oracle Forms only...


            My Problem is


            If empno,ename,sal items are empty then ...

            In alert message it should show



                               Sal fields are empty..

            fill these  items.


            According to your code it will show only alert message but I want the item fields in the Block are displayed in the alert message.



            it should dynamically or when i pressed button in form it should show the alert message with above items.


            If required item fields 2  are empty then alert message should show the 2 item fields are empty...

            if 3 then 3 items should be shown in alert message....




            • 3. Re: alert-fields should not be empty

              Do you want this option for  learning  yourself  or for business  (job) related.


              Simple right click the field Empno and select  'Requried ->'Yes'.   


              Now your form will take care itself , and user cannot save record untill the supplies  this filed. User also will get message at status bar.


              In case , for learning purpose,


              after alter message, after user  selecting yes/no  say 1 or 2, 


              If  Alter_Answer =1  Then  Message 'Alter Box yes selected';


              Message(Alter Box NO is selected');


              ENd If;


              You  can do code accordingly,.

              • 4. Re: alert-fields should not be empty
                The Learner

                I tried this on EMP table.... Is it correct???????????

                I write this code in WHEN-BUTTON-PRESSED


                  alrt varchar2(20);

                  alrt2 varchar2(120);






                  alrt2:='Enter These items'||chr(13)||chr(10);

                  if :emp.deptno is null then

                  alrt2:='Department number'||chr(13)||chr(10);

                  end if;


                  if :emp.ename is null then


                  end if;


                  if :emp.sal is null then


                  end if;



                  if :dept.deptno is not null and :emp.ename is not null and :emp.sal is not null then




                  alrt:= show_alert('NULL');

                  end if;



                # Chr(10) returns a linefeed character

                # Chr(13) returns a carriage return character


                Other wise help me try to reduce the code.....


                Thanks & Regards,


                • 5. Re: alert-fields should not be empty
                  Andreas Weiden

                  Your code works, but will hav a lot of work if you want to do that for every form of a bigger application. Any reason why you don't set the required-property of the items which are required? Then there would be no need for that coding.

                  • 6. Re: alert-fields should not be empty
                    The Learner

                    Instead of Message I tried to display alert message....

                    In a normal website I saw that and I tried in Oracle Forms.



                    There is any chance to reduce the code....


                    Thanks & Regards,