Solved

Want popup message displayed only once on clicking a link

Posted on 2006-11-07
12
217 Views
Last Modified: 2008-01-16
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('<FONT SIZE = 4 >'||
ASCK_Validations.ReturnURL(p_job_number))||'</FONT>');
                        htp.tabledata('&nbsp&nbsp&nbsp&nbsp&nbsp&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_AuthorisedItems.addAuthorisedItemsForm?p_job_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.forminsert?P_JOB_NUMBER='
                        ||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('Invalid User: Please Call Administrator');
                  RETURN sURL;
            END IF;
            EXCEPTION
                  WHEN OTHERS THEN      
                           ASCK_Utility.ShowAlert(SQLERRM);
                           RETURN sURL;
      END ReturnURL;
END ASCK_VALIDATIONS;
0
Comment
Question by:aman_greval
  • 6
  • 4
  • 2
12 Comments
 
LVL 75

Expert Comment

by:Michel Plungjan
Comment Utility
If I know what language you coded it in then perhaps I could find where to put the cookie you need.
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
0
 

Author Comment

by:aman_greval
Comment Utility
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.error_code||' : '||REPLACE(p_message.error_message,'"','')||'");</SCRIPT>');
END ShowAlert;
0
 
LVL 16

Accepted Solution

by:
LeeKowalkowski earned 500 total points
Comment Utility
So you still need the link?  Then don't comment the link out!  

sURL := htf.anchor(cURL=>'javascript:alert("Invalid User: Please Call Administrator")', cText=>htfbold('ASC Order'));

Plus I assume you meant "once" as in "only when clicking on a link", as opposed to "only the first time a link is clicked".
0
 
LVL 75

Expert Comment

by:Michel Plungjan
Comment Utility
or

htp.p('<SCRIPT>var x=true; if(x) { x=false; alert("'||p_message.error_code||' : '||REPLACE(p_message.error_message,'"','')||'"); }</SCRIPT>');
0
 

Author Comment

by:aman_greval
Comment Utility
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=>'javascript:alert("Invalid User: Please Call Administrator")', cText=>htfbold('ASC Order'));
0
 

Author Comment

by:aman_greval
Comment Utility
Error on compilation is: identifier HTFBOLD must be declared.!
sURL := htf.anchor(cURL=>'javascript:alert("Invalid User: Please Call Administrator")', cText=>htfbold('ASC Order'));
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 16

Expert Comment

by:LeeKowalkowski
Comment Utility
Sorry, it's htf.bold!
0
 

Author Comment

by:aman_greval
Comment Utility
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(
0
 
LVL 16

Expert Comment

by:LeeKowalkowski
Comment Utility
Doh, you'll need to escape those quotes!

cURL=>'javascript:alert(&quot;Invalid User: Please Call Administrator&quot;)'

Currently your attributes are ending prematurely: <a href="javascript:alert("...>

Sorry, about that!
0
 

Author Comment

by:aman_greval
Comment Utility
Doh, you'll need to escape those quotes!
cURL=>'javascript:alert(&quot;Invalid User: Please Call Administrator&quot;)'

By escaping quotes you mean backslash..

0
 
LVL 16

Expert Comment

by:LeeKowalkowski
Comment Utility
Well, no, I meant changing " to &quot;
0
 

Author Comment

by:aman_greval
Comment Utility
Hi LeeKowalkowski:
Solved:
sURL := HTF.anchor(cURL=>'javascript:alert('||'''Invalid User: Please Call Administrator2'''||')', cText=>htf.bold('ASC Order'));
Thanks
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now