aman_greval
asked on
Want popup message displayed only once on clicking a link
We have an application that runs both in RealTime and Batch.
We are phasing out the Batch one in favour of RealTime.
RealTime application means that data is sent from one pc to another in
a single click of a button instantly.
Batch application waits for CRON job to run to send it across to the other pc.
How this system works? Under the hood we have a function that checks if the job
is realtime or batch (FUNCTION CheckRealTimeASCJob)
If the job is RealTime then it sets the url (basically i need not thouch this code)
If the job is Batch then Instead of follwing the url set by ReturnURL function, i
need to display a popup message That shows "INVALID USER, CONTACT ADMINISTRATOR"
I have done that here, but however, i get this popup each time i navigate.
i need this popup only once when the user chooses ASC Order link. How to do this?
Planning_Menu procedure calls ReturnURL function.
ReturnURL sets the URL page depending on job is realtime or batch.
PROCEDURE PLANNING_MENU (P_JOB_NUMBER IN JOBS.JOB_NUMBER%TYPE)
IS
BEGIN
:
:
:
htp.tabledata(htf.em('<FON T SIZE = 4 >'||
ASCK_Validations.ReturnURL (p_job_num ber))||'</ FONT>');
htp.tabledata('  & nbsp & nbsp & nbsp & nbsp');
:
:
END PLANNING_MENU;
PACKAGE ASCK_VALIDATIONS
IS
FUNCTION ReturnURL(p_job_number IN jobs.job_number%TYPE)
RETURN VARCHAR2
IS
BEGIN
bRealtimeOuc := CheckRealTimeASCJob(p_job_ number) ;
--Checks and returns if the job is realtime or batch job.
IF bRealtimeEstimate = 1 THEN
--RealTime job. Do nothing. Follow the URL returned by the function
sURL := htf.anchor
(cURL=>'asck_AuthorisedIte ms.addAuth orisedItem sForm?p_jo b_number='
||p_job_number,cText=>htf. strong(htf .em('<FONT SIZE = 4 >' ||'ASC Order'||'</FONT>')),
cAttributes=>sAttribute);
ELSE --batch job.
--Comment setting of url, instead popup the message and freeze the screen.
/*sURL := htf.anchor(cURL=>'nim2204w $o_hdrs.fo rminsert?P _JOB_NUMBE R='
||p_job_number||'=0',cText =>htf.bold ('ASC Order'));*/
--if the user is batch user then this alert is shown on every time on navigation
--from one screen to another. I want that it should be shown only once when the user
--presses the link "ASC Order"
asck_utility.showalert('In valid User: Please Call Administrator');
RETURN sURL;
END IF;
EXCEPTION
WHEN OTHERS THEN
ASCK_Utility.ShowAlert(SQL ERRM);
RETURN sURL;
END ReturnURL;
END ASCK_VALIDATIONS;
We are phasing out the Batch one in favour of RealTime.
RealTime application means that data is sent from one pc to another in
a single click of a button instantly.
Batch application waits for CRON job to run to send it across to the other pc.
How this system works? Under the hood we have a function that checks if the job
is realtime or batch (FUNCTION CheckRealTimeASCJob)
If the job is RealTime then it sets the url (basically i need not thouch this code)
If the job is Batch then Instead of follwing the url set by ReturnURL function, i
need to display a popup message That shows "INVALID USER, CONTACT ADMINISTRATOR"
I have done that here, but however, i get this popup each time i navigate.
i need this popup only once when the user chooses ASC Order link. How to do this?
Planning_Menu procedure calls ReturnURL function.
ReturnURL sets the URL page depending on job is realtime or batch.
PROCEDURE PLANNING_MENU (P_JOB_NUMBER IN JOBS.JOB_NUMBER%TYPE)
IS
BEGIN
:
:
:
htp.tabledata(htf.em('<FON
ASCK_Validations.ReturnURL
htp.tabledata('  &
:
:
END PLANNING_MENU;
PACKAGE ASCK_VALIDATIONS
IS
FUNCTION ReturnURL(p_job_number IN jobs.job_number%TYPE)
RETURN VARCHAR2
IS
BEGIN
bRealtimeOuc := CheckRealTimeASCJob(p_job_
--Checks and returns if the job is realtime or batch job.
IF bRealtimeEstimate = 1 THEN
--RealTime job. Do nothing. Follow the URL returned by the function
sURL := htf.anchor
(cURL=>'asck_AuthorisedIte
||p_job_number,cText=>htf.
cAttributes=>sAttribute);
ELSE --batch job.
--Comment setting of url, instead popup the message and freeze the screen.
/*sURL := htf.anchor(cURL=>'nim2204w
||p_job_number||'=0',cText
--if the user is batch user then this alert is shown on every time on navigation
--from one screen to another. I want that it should be shown only once when the user
--presses the link "ASC Order"
asck_utility.showalert('In
RETURN sURL;
END IF;
EXCEPTION
WHEN OTHERS THEN
ASCK_Utility.ShowAlert(SQL
RETURN sURL;
END ReturnURL;
END ASCK_VALIDATIONS;
ASKER
Hi mplungjan:
This is coded in Oracle pl/sql. Packages you see like htf.anchor are oracle packages that facilitate
using oracle pl/sql with web languages like javascript. This package basically "web-enables" pl/sql.
Inside the packages javascript is used as usual.
Code for ShowAlert
PROCEDURE ShowAlert(p_message IN AscErrorMessages)
IS
BEGIN
htp.p('<SCRIPT>alert("'||p _message.e rror_code| |' : '||REPLACE(p_message.error _message,' "','')||'" );</SCRIPT >');
END ShowAlert;
This is coded in Oracle pl/sql. Packages you see like htf.anchor are oracle packages that facilitate
using oracle pl/sql with web languages like javascript. This package basically "web-enables" pl/sql.
Inside the packages javascript is used as usual.
Code for ShowAlert
PROCEDURE ShowAlert(p_message IN AscErrorMessages)
IS
BEGIN
htp.p('<SCRIPT>alert("'||p
END ShowAlert;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
or
htp.p('<SCRIPT>var x=true; if(x) { x=false; alert("'||p_message.error_ code||' : '||REPLACE(p_message.error _message,' "','')||'" ); }</SCRIPT>');
htp.p('<SCRIPT>var x=true; if(x) { x=false; alert("'||p_message.error_
ASKER
Hi LeeKowalkowski:
This solution is giving me an error. Error during menu creation. If this works, it would be a great solution.
Something that fit's my need.
sURL := htf.anchor(cURL=>'javascri pt:alert(" Invalid User: Please Call Administrator")', cText=>htfbold('ASC Order'));
This solution is giving me an error. Error during menu creation. If this works, it would be a great solution.
Something that fit's my need.
sURL := htf.anchor(cURL=>'javascri
ASKER
Error on compilation is: identifier HTFBOLD must be declared.!
sURL := htf.anchor(cURL=>'javascri pt:alert(" Invalid User: Please Call Administrator")', cText=>htfbold('ASC Order'));
sURL := htf.anchor(cURL=>'javascri
Sorry, it's htf.bold!
ASKER
LeeKowalkowski:
i have used htf.bold. It runs without errors now.
However, when i click on the ASC Order link. Nothing happens. I was expecting an alert to pop up.
On the status bar, all i see is javascript.alert(
i have used htf.bold. It runs without errors now.
However, when i click on the ASC Order link. Nothing happens. I was expecting an alert to pop up.
On the status bar, all i see is javascript.alert(
Doh, you'll need to escape those quotes!
cURL=>'javascript:alert(&q uot;Invali d User: Please Call Administrator")'
Currently your attributes are ending prematurely: <a href="javascript:alert(".. .>
Sorry, about that!
cURL=>'javascript:alert(&q
Currently your attributes are ending prematurely: <a href="javascript:alert("..
Sorry, about that!
ASKER
Doh, you'll need to escape those quotes!
cURL=>'javascript:alert(&q uot;Invali d User: Please Call Administrator")'
By escaping quotes you mean backslash..
cURL=>'javascript:alert(&q
By escaping quotes you mean backslash..
Well, no, I meant changing " to "
ASKER
Hi LeeKowalkowski:
Solved:
sURL := HTF.anchor(cURL=>'javascri pt:alert(' ||'''Inval id User: Please Call Administrator2'''||')', cText=>htf.bold('ASC Order'));
Thanks
Solved:
sURL := HTF.anchor(cURL=>'javascri
Thanks
Perhaps in the library with the ShowAlert you can put some code. But right now I have no idea what to do with your code