Home » Developer & Programmer » Forms » logon screen (forms 10g window xp)
logon screen [message #451317] Wed, 14 April 2010 00:46 Go to next message
dsora
Messages: 24
Registered: May 2009
Junior Member
Hi All,
I am using default logon screen to allow user to login DB via forms. Code which is in on-logon trigger as follows.
DECLARE
	connected BOOLEAN := FALSE;
	tries NUMBER := 3;
	un VARCHAR2(30);
	pw VARCHAR2(30);
	cs VARCHAR2(30);
	n number;
BEGIN
		SET_APPLICATION_PROPERTY(CURSOR_STYLE, 'DEFAULT');
	WHILE connected = FALSE and tries > 0 LOOP
 
		LOGON_SCREEN;
	 
		un := GET_APPLICATION_PROPERTY( USERNAME );
		pw := GET_APPLICATION_PROPERTY( PASSWORD );
		cs := GET_APPLICATION_PROPERTY( CONNECT_STRING );
		 
		LOGON( un, pw || '@' || cs,false);
	 
		IF FORM_SUCCESS THEN
			connected := TRUE ;
		else
			set_alert_property('Stop',ALERT_MESSAGE_TEXT,'Invalid user name/password/connect string.');	
			n := show_alert('Stop');
		END IF;
		
		tries := tries - 1;
	END LOOP;
	IF NOT CONNECTED THEN
		MESSAGE('Too many tries!');
		RAISE FORM_TRIGGER_FAILURE;
	END IF;
END;


When the first time logon screen appears I pressed 'Cancel' button. It is suppose to exit the logon form/application but it has connected to DB and entered into the block.
Can anyone please help me, if I am missing anything in the on logon trigger code or anything else.

[Updated on: Wed, 14 April 2010 00:49]

Report message to a moderator

Re: logon screen [message #451321 is a reply to message #451317] Wed, 14 April 2010 00:58 Go to previous messageGo to next message
deepankar_04
Messages: 29
Registered: August 2009
Location: Udaipur, Rajasthan, INDIA
Junior Member
Can you post what have you written in WHEN-BUTTON-PRESSED trigger of 'CANCEL' button of log-on form.
Re: logon screen [message #451323 is a reply to message #451317] Wed, 14 April 2010 01:01 Go to previous messageGo to next message
dsora
Messages: 24
Registered: May 2009
Junior Member
Its a default logon screen...
No need to code anything (used default LOGON_SCREEN built in)
Re: logon screen [message #451471 is a reply to message #451323] Thu, 15 April 2010 00:33 Go to previous messageGo to next message
ammadahmed
Messages: 7
Registered: April 2010
Location: Pakistan
Junior Member
Hi,
Actually when you press CANCEL on default login screen. Then sure ti will open you form. But it is not actually LOGON to the database. If you try to fetch the data it will not show you anydata. But this is default behavior of forms. It will open your form but actually it is not connected to the database. Because you did not provide any login information you just pressed cancel. It will vanished the default login screen and will open for you your designed form.

Hope its clear.

-Ammad
Re: logon screen [message #451593 is a reply to message #451317] Thu, 15 April 2010 10:06 Go to previous messageGo to next message
dsora
Messages: 24
Registered: May 2009
Junior Member
<Then sure ti will open you form. But it is not actually LOGON to the database.>

I am able query and manipulate the data (logged to DB)!!!.

user expects that application/login form will exit when presses on cancel... because user doesn't want to login.
Re: logon screen [message #453210 is a reply to message #451593] Tue, 27 April 2010 22:27 Go to previous messageGo to next message
dsora
Messages: 24
Registered: May 2009
Junior Member
Can any one please...
Re: logon screen [message #453241 is a reply to message #453210] Wed, 28 April 2010 00:44 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Did you try to put
exit_form(no_validate);
into the "Cancel" WHEN-BUTTON-PRESSED trigger?
Re: logon screen [message #453247 is a reply to message #451317] Wed, 28 April 2010 01:04 Go to previous messageGo to next message
dsora
Messages: 24
Registered: May 2009
Junior Member
Hi,
Thank you for your reply.

Quote:

Did you try to put
exit_form(no_validate);
into the "Cancel" WHEN-BUTTON-PRESSED trigger?

Can we change the code of default logon screen's Cancel button, which is invoked by LOGON_SCREEN built in, if so please let me know how to change the code.
Re: logon screen [message #453249 is a reply to message #453247] Wed, 28 April 2010 01:21 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Oh, I see! (At least, I *think* I do)

I don't know whether it is possible to do that or not, but I guess not. I thought that it is your logon form; sorry.

However: perhaps you could perform certain test in WHEN-NEW-FORM-INSTANCE trigger which would try to, for example, select from dual. If it succeeds, you are logged on. If not, exit form.

I wouldn't know what error is raised when you are not connected to a database and try to select something. I guess it is something like "not connected", like in this SQL*Plus example:
SQL> connect scott/blabla@ora10
ERROR:
ORA-01017: invalid username/password; logon denied


Warning: You are no longer connected to ORACLE.
SQL> select 'x' from dual;
SP2-0640: Not connected
SQL>
Forms will probably raise some other error (not SP2-0640) - try and see.
Re: logon screen [message #453253 is a reply to message #451317] Wed, 28 April 2010 01:49 Go to previous messageGo to next message
dsora
Messages: 24
Registered: May 2009
Junior Member
Hi,
Thank you, My requirement is to come out of the application when user chooses 'Cancel' button, when asked to logon (i.e. by logon_screen buit-in).

But when I press 'Cancel' button application is logging to DB and opening the first navigable block, which should not happen.
Quote:
However: perhaps you could perform certain test in WHEN-NEW-FORM-INSTANCE trigger which would try to, for example, select from dual. If it succeeds, you are logged on. If not, exit form.


Why do I need to code in WHEN-NEW-FORM-INSTANCE trigger. If so then what is the use 'Cancel' button in default logon screen.

My question/doubt is why logon screen allowing user to login though (s)he does not want to login (user want to come out by pressing 'Cancel').

[Updated on: Wed, 28 April 2010 01:59]

Report message to a moderator

Re: logon screen [message #453321 is a reply to message #453253] Wed, 28 April 2010 04:42 Go to previous message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
sateesh240@gmail.com wrote on Wed, 28 April 2010 08:49
Why do I need to code in WHEN-NEW-FORM-INSTANCE trigger. If so then what is the use 'Cancel' button in default logon screen.

It is a (possible?) workaround. I don't know why Cancel doesn't work as your users would like it to. I don't know what code really stands behind that button. But, if it doesn't work and you can't modify default logon form, I guess you'll have to develop your own solution(s). WHEN-NEW-FORM-INSTANCE with EXIT_FORM *might* be one of them.
Previous Topic: Data block
Next Topic: Run crystal report from oracle forms.
Goto Forum:
  


Current Time: Fri Sep 20 09:39:24 CDT 2024