Home » Developer & Programmer » Forms » when_button_pressed (4 threads merged by bb) (Forms oracle 10g)
when_button_pressed (4 threads merged by bb) [message #539455] Mon, 16 January 2012 02:20 Go to next message
furqan
Messages: 110
Registered: January 2012
Location: Hyderabad
Senior Member
declare
a_value_chosen boolean;
begin

a_value_chosen := Show_Lov('lov130');

IF NOT a_value_chosen THEN
message('You have not selected your Department Name');
bell;
RAISE form_trigger_failure;
END IF;
END;

i write the above code on push button but still even
without choosing anything from the list..if i directly press
the login button its not showing the messgae 'You have not selected your Department Name' and getting navigated to other form.

iam really new to form but had learned a lot since last 1 month,its really an interesting field..

thanks in advance for your help..
Re: when_button_pressed (3 threads merged by bb) [message #539458 is a reply to message #539455] Mon, 16 January 2012 03:17 Go to previous messageGo to next message
cookiemonster
Messages: 10590
Registered: September 2008
Location: Rainy Manchester
Senior Member
1) Please read and follow How to use [code] tags and make your code easier to read?
2) If I understand correctly the above code is in one button and you are pressing a different button and expecting to see the message?
Re: when_button_pressed (3 threads merged by bb) [message #539514 is a reply to message #539458] Mon, 16 January 2012 11:24 Go to previous messageGo to next message
Tomcrzy
Messages: 101
Registered: December 2011
Location: Chennai,India
Senior Member

Hi furqan,

Quote:

i write the above code on push button but still even
without choosing anything from the list..if i directly press
the login button its not showing the messgae 'You have not selected your Department Name' and getting navigated to other form.


I don't think so. May be you had made some mistakes.

I will give you the steps
button->trigger(when_Button_Pressed->write your code ->Write the message two times if you want to see it in a window or as inside a message box

DECLARE
  a_value_chosen BOOLEAN;
BEGIN
  a_value_chosen := Show_Lov('lov130');
  IF NOT a_value_chosen THEN
    MESSAGE('You have not selected your Department Name');
    MESSAGE('You have not selected your Department Name');
    bell;
    RAISE form_trigger_failure;
  END IF;
END;


After compilation when you pressing the button it will throw an error(FRM-40202 Field must be entered )
then enter somedata inside the field and press the button the LOV will displays->cancel it


Quote:

the login button its not showing the messgae 'You have not selected your Department Name' and getting navigated to other form.


the message will displays.

Better you can go for when_new_form_instance trigger.

Thanks &Regards
Tom

[Updated on: Mon, 16 January 2012 11:28]

Report message to a moderator

Re: when_button_pressed (3 threads merged by bb) [message #539516 is a reply to message #539514] Mon, 16 January 2012 11:31 Go to previous messageGo to next message
Tomcrzy
Messages: 101
Registered: December 2011
Location: Chennai,India
Senior Member

Is this anything important

bell;


in your code???

[Updated on: Mon, 16 January 2012 11:46]

Report message to a moderator

Re: when_button_pressed (3 threads merged by bb) [message #539555 is a reply to message #539514] Tue, 17 January 2012 02:24 Go to previous messageGo to next message
furqan
Messages: 110
Registered: January 2012
Location: Hyderabad
Senior Member
No bell; is not important.
as show here i have tried when_new_form_instance and also when_new_item_instance in place of when_button_pressed.

the thing is i think when the user is leaving the department null and press the login button directly then it should display a message('You have not selected your Department Name')

i tried
IF :USER_ACS.department_NAME is null THEN
message('You have not selected your Department Name');

END IF;
on (when_button_pressed) on login,its showing the message if the user is not select dept. from the list..but when pressed ok its still getting navigated to next form.
i want it to go back on dept name to select.

thanks all who have replied and really appreciate and iam thankful to u all.
Re: when_button_pressed (3 threads merged by bb) [message #539556 is a reply to message #539555] Tue, 17 January 2012 02:34 Go to previous messageGo to next message
Littlefoot
Messages: 18844
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
The simplest way is to set that item's REQUIRED property to "YES". Doing so, you don't need any trigger.

By the way, just as an exercise, what happens if you modify code you posted in your previous message to this:[code]
IF :USER_ACS.department_NAME is null THEN
   message('You have not selected your Department Name');

   raise form_trigger_failure;      -- include this line

END IF;

In other words: you told the user that there's something wrong, but you didn't raise an error so, after acknowledging the message, form continued its execution normally.
Re: when_button_pressed (3 threads merged by bb) [message #539568 is a reply to message #539555] Tue, 17 January 2012 03:48 Go to previous messageGo to next message
furqan
Messages: 110
Registered: January 2012
Location: Hyderabad
Senior Member
Included... raise form_trigger_failure;...
still going to next form not going back to dept name list.
Re: when_button_pressed (3 threads merged by bb) [message #539569 is a reply to message #539568] Tue, 17 January 2012 03:51 Go to previous messageGo to next message
Littlefoot
Messages: 18844
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
me
The simplest way is to set that item's REQUIRED property to "YES". Doing so, you don't need any trigger.
Re: when_button_pressed (3 threads merged by bb) [message #539589 is a reply to message #539568] Tue, 17 January 2012 05:10 Go to previous messageGo to next message
furqan
Messages: 110
Registered: January 2012
Location: Hyderabad
Senior Member
REQUIRED PROPERTY HAS BEEN CHANGED TO 'YES' STILL THE SAME.

I THINK WE MUST RAISE AN EXCEPTION ON LOGIN BUTTON ???
Re: when_button_pressed (3 threads merged by bb) [message #539661 is a reply to message #539589] Tue, 17 January 2012 12:20 Go to previous message
cookiemonster
Messages: 10590
Registered: September 2008
Location: Rainy Manchester
Senior Member
Don't post in all caps - it's considered shouting in all internet forums. What code is currently in the login button?
Previous Topic: Troubles executing a Form with a JPG Imported Image on Canvas
Next Topic: trigger to capture the user details
Goto Forum:
  


Current Time: Wed Apr 23 16:51:08 CDT 2014

Total time taken to generate the page: 0.08388 seconds