Email Us : sunilkumark11@gmail.com
Free Training > SQL PL / SQL Forms Reports Oracle Applications
< Previous Next >

 
Forms - Creating password screen

Open existing form EMPTHREE.FMB
Create control block ( Manually ). In the property palette , provide the following properties
General
Name BLK1
Database
Database Data block No
( When we mention Database Data block as NO, the block is called as control block ).
Create a canvas. In the property palette, provide the following properties
General
Name CNV1
Place a text item in the canavas ( CNV1) , provide the following properties
General
Name T1
Functional
Conceal Data Yes ( hides the password )
Prompt
Prompt Enter Password

Create a button, provide the following properties
General
Name B1
Functional
Label OK
Create WHEN-BUTTON-PRESSED  trigger for button B1

Provide the following code
begin
if :T1 ='sunil' then
next_block;
else
message ( 'Invalid password !!! Try again ? ');
message ( ' ');
go_item ( 'T1');
clear_item;
raise  form_trigger_failure;
end if;
end;

Click on compile.
File Save
File Compile Module

File Run form

If you enter the password as  sunil  and click on OK  , you will be directed to the next block.

Otherwise you get an error message

Restricting the end user for 3 trials
In EMPTHREE.FMB, declare a global variable.
( How to declare a global variable )
In PRE-FORM  trigger  ( form level fired before entering into form )
Provide the following code
:GLOBAL.ct :=0;
Click on compile.

Note:
Global variables will support all data types.
It can be assigned with any type of value.
It can be used throughout  the application.
Syntax:
:GLOBAL. < var_name> := < value > ;

 

In WHEN-BUTTON-PRESSED trigger of button ( B1)
Replace the old code with the following new code
begin
if :T1 ='sunil' then
next_block;
else
:GLOBAL.ct := :GLOBAL.ct + 1;
if :GLOBAL.ct >=3 then
exit_form;
end if;
message ( 'Invalid password !!! Try again ? ');
message ( ' ');
go_item ( 'T1');
clear_item;
raise  form_trigger_failure;
end if;
end;
compile.

File Save
File Compile Module
File Run form
Now, when you provide invalid password for three or more than three times, the form will be exited.

 


< Previous Next >