Confirm Box from PL/SQL process

Hi all,
I am using Apex 4.1. I have a page from which on cilck of submit button, a process runs. Now this process checks for certain page item values and based on them, a confirmation box is required. Now based on what the user chooses, either a procedure should be called or no action should be taken. I have written the following code but it does not seem to work.
declare
v_count number;
begin
v_count:=0;
FOR i IN 1 .. apex_application.g_f07.COUNT
LOOP
if (apex_application.g_f07 (i) is not null) then
v_count := v_count + 1;
end if;
end loop;
if (v_count > 0)
then
htp.p('<script type="text/javascript">');
htp.p('
var r=confirm("Data entered for Saturday, do you want to proceed?");
if (r==true)
PR_TIMESHEET(:P11_PROJ_REF,:P11_RELEASE_ID,:P11_EMP,:P11_DATE,:no_of_rows);
else
htp.p('</script>');
else
PR_TIMESHEET(:P11_PROJ_REF,:P11_RELEASE_ID,:P11_EMP,:P11_DATE,:no_of_rows);
end if;
end;
I dont know much about Javascript, just got this code through google.....
Any help would be appreciated.
Thanks in advance.

rest_in_peace wrote:
Hi all,
I am using Apex 4.1. I have a page from which on cilck of submit button, a process runs. Now this process checks for certain page item values and based on them, a confirmation box is required. Now based on what the user chooses, either a procedure should be called or no action should be taken. I have written the following code but it does not seem to work.
declare
v_count number;
begin
v_count:=0;
FOR i IN 1 .. apex_application.g_f07.COUNT
LOOP
if (apex_application.g_f07 (i) is not null) then
v_count := v_count + 1;
end if;
end loop;
if (v_count > 0)
then
htp.p('<script type="text/javascript">');
htp.p('
var r=confirm("Data entered for Saturday, do you want to proceed?");
if (r==true)
PR_TIMESHEET(:P11_PROJ_REF,:P11_RELEASE_ID,:P11_EMP,:P11_DATE,:no_of_rows);
else
htp.p('</script>');
else
PR_TIMESHEET(:P11_PROJ_REF,:P11_RELEASE_ID,:P11_EMP,:P11_DATE,:no_of_rows);
end if;
end;
I dont know much about Javascript, just got this code through google.....
Any help would be appreciated.
Thanks in advance.Does this help? javascript in pl/sql process block

Similar Messages

  • Alert/Warning messages from PL/SQL process

    Hi all,
    I have a PL/SQL process that I execute from javascript : doSubmit(MY_PROCESS). I want to output an alert box if some errors occurs in the process, for instance : alert('message'). Does anyone know how to do that ?
    Best regards,
    Othman.

    Thanks Andy for the reply.
    My process executes "after submit", so I cannot call directly the javascript as one mentioned. The call to "html_Get" seems to be quite complicated for a simple alert message which is not really a Application process shared component.
    So I'll go for a solution where users won't see error messages ...
    Best regards,
    Othman.

  • Calling Javascript function from PL/SQL Process

    I am new to APEX and Javascript so please forgive my question.
    I have a process on page which successfully runs a few procedures etc. but now, as part of this process, I want to call a javascript function I have typed into the HTML Header.
    My question is how can I call the javascript function from my process? Is it possible?
    Many thanks
    Winnie
    ps. as an example my javascript looks like:
    <script language="JavaScript">
    function test(){
    var decision = confirm("Click a button below and watch what pops up next.");
    alert(decision);
    </script>

    See: How to call a javascript function from pl/sql?

  • Apex: output message from pl/sql process

    Apex 4.2
    THis is kind of an Apex and Pl/Sql question, but more so Apex because I'm using that environment. I have a pl/sql process with an IF - Else statement. It's a real simple process where you check:
    IF P101_Count > 1 Then
       Do stuff;
    Else
       Output an error message.
    The process runs when I click a button.
    I am just not sure how to get an error message to display to the screen. I am not sure of the syntax.
    Any help on this topic would be greatly appreciated. Thanks in advance.

    Well, there a lots of ways to do this but, if you just want to see it on the screen, the easiest way is to add a Page Item (a Text Field for example). Then, in the Else portion just set it equal to the message that you are trying to display.
    If ( :P101_Count > 1 ) Then
    -- Do Stuff
    Else
    :P1_MY_MESSAGE := 'Hello World!';
    End If;
    -Joe

  • Need to run popup from pl/sql process with a twist

    I am trying to do the following:
    User comes in and selects a date/time for a process to be started at a certain station. User then goes to click create button. Either on the exiting of the date/time picker or the click of the create button, I would like to run a process to determine if there is already something scheduled for that time/station. If there is already something scheduled, I would like to alert them to the fact and confirm if they want to shift the exiting item around and have the just entered item go in it's place..
    Trying to do this in APEX 4.02, Oracle 11g database..
    Thank you,
    Tony Miller
    LuvMuffin Software
    (281) 871-0950

    Luis,
    Thanks for the input.. What I am trying to do is this:
    User comes into page and selects a item to process, then a workstation and a start time & end time for the processing
    After the start and end times are selected I am developing a dynamic action to alert them if a process is already scheduled
    ** NOW ** here is where it gets interesting.. If a item is already scheduled, the want to bump that item from that time & workstation and put the just entered item into the schedule.
    I am looking at a dynamic action, but do NOT yet have the knowledge to do multiple things in it (Only if this is a NEW item):
    I know how to query the table to confirm if there is already and item with the workstation & start-end time period
    Need to see how to generate a popup (confirmation) to confirm they want to bump the existing entry
    I know how to generate the update statement to update the existing item.
    Thank you,
    Tony Miller
    Webster, TX
    If vegetable oil is made of vegetables, what is baby oil made of?

  • How to remove AutoCommit from PL/SQL Process

    Hi Have some drop down to select by the customer in a form .
    Once the customer selects the data from drop down he/she will hit SUBMIT button .. data will get updated abd also gets automatically commited .
    What i need to do :-
    As soon as i hit SUBMIT .. data should only show without commiiting . Once commit button is pressed the data should get comiited .
    Is there a way which i can achive this ?
    Regards,
    Nish
    Edited by: 862509 on Mar 4, 2012 10:31 AM

    862509 wrote:
    Hi Have some drop down to select by the customer in a form .
    Once the customer selects the data from drop down he/she will hit SUBMIT button .. data will get updated abd also gets automatically commited .
    What i need to do :-
    As soon as i hit SUBMIT .. data should only show without commiiting . Once commit button is pressed the data should get comiited .
    Is there a way which i can achive this ? You need to When commit is executed?. As APEX commits when page processing is completed, any updates performed during processing will be committed.
    If you want to defer changes as described, post the initial submissions temporarily to APEX collections, then update the final tables from there when the user chooses to commit.
    (Please update your forum profile with a real handle instead of "862509".)

  • How to display confirm message in APEX pl/sql process

    I have a pl/sql process that selects success messages from a database table. These messages need to be displayed to the user and confirmed (only one button, to acknowledge/dismiss the mssage) along the way.
    Is there a way to do this within the process? I see lots of examples in the Forum of doing this in javascript (which I know very little about) but suspect there must be a simple way to do this in my pl/sql process.
    Help?
    Thanks,
    Carol

    Hi Carol,
    You can put you success messages inside page items or application items (when pages are rendered or processed...).
    Then using :
    1) javascript can display these values
    2) rendering the page can display these values
    Hope this help
    Louis-Guillaume
    Homepage : http://www.insum.ca
    InSum Solutions' blog : http://insum-apex.blogspot.com

  • Process Order accepts Confirmation & GR from BAPI even after Confirmed

    No matter what i try the formatting and CRLF go for a toss in this text.
    Hi PPPI Gurus,
    I am a beginner in this area and request your help.
    We are implementing a project where the process order Confirmation in SAP ECC 5.0 in SAP PPPI module is done using xMII which call the BAPI_PROCORD_CREATE_TT     RFC.
    The customer wants to (certain times) do a final confirmation without actually completing the order e.g if the Order Qty is 100 then, they want to just manufacture 25 and then do a final confirmation, after which SAP GUI screen does not allow any Process order Confirmations against that process order.
    We are using the BAPI_PROCORDCONF_CREATE_TTRFC to do multiple PO Confirmations and GR for particular Process order. Below is a scenario
    Case 1:
    1. Order Qty =100  ( Unlimited Delivery is not checked and tolerance is Zero).
         Which means only 100 is accepted.
    2. 100 Quantities are produced and confirmed using the BAPI_PROCORDCONF_CREATE_TT (with Final confirmation value as 1 , which mean auto confirmation)
    3. Next when the BAPI confirms & GR's against the same order, the Complete qty is not visible in the COR3 status. And is visible only in the COGI transaction.
    That is expected behavior. and i am ok with that.
    Case 2: (The one with the problem)
    1.  Order Qty =100  ( Unlimited Delivery is not checked and tolerance is Zero).
         Which means only the 100 is accepted.
    2.  25 Quantities are produced and confirmed using BAPI_PROCORDCONF_CREATE_TT (with Final Confirmation value as X , which mean Final confirmation)
    3. The Confirmation and GR go through and the status of the process order now changed is CNF and the Deliverd qty is 25.
    At this point , if you logon to SAP GUI and try to make a process order confirmation you get an error messages which says the Process Order is already confirmed and no more confirmations or GR can be done against this Process order.
    4. But when you Again Run the BAPI_PROCORDCONF_CREATE_TT, it goes ahead and confirms and makes the GR for that Process order.
    The Expected Behavior should have been that this quantity is now in the COGI transaction.
    5. The Process order  allows any number of Further confirmations till the Ordered Qty and Delivered quantity are  same .
    so dear gurus I know i have written a very long doubt but would be very happy to get a response from you. I would ideally not like to enhance or change the BAPI and want to understand if I have missed some setting or parameter that I have to pass in the BAPI for the final confirmation so that once the Status of the Process order is CNF , no more Confirmations are allowed even from the BAPI.
    Thanks in Advance.
    Regards
    Suraj
    Edited by: surajprabhu on Aug 17, 2009 6:37 AM

    Hi,
    The standard SAP will allow the GR even after the Final Confirmation. The Final Confirmation is acting as a agent to change the status of the process order to CNF. thats all.
    If you want to restrict the GR then you have to do Enhancement with  use the USer Exits. Pleas try to use the User Exits PPC00009 or MBCF0001,MBCF0005
    thanks and regards
    murugesan

  • Button, Javascript Confirm Box and Process

    I have a button on a page. When someone click on the button, depends on the value on a item, if it's not null, then pop up a confirmation box, if the item is null, the call a process directly. If the confimation is true, then call the same process, otherwise page won't be to submitted.
    I' m still on version 1.6.
    Anyone could give me some help?
    million thanks!
    Ran

    Thans for the reply.
    Here is what I did:
    I created another item called itemB. And put a javascript function on the HTML Header. And put a image button and use onclick to trigger the function. Based on the confirm is true or false, the javascript will set the itemB to two different values. And the process will run based on the value of the itemB. It seems to work sometimes, but not always. I don't know if I am missing anything or maybe it's not a right way to do it. Could someone take a look for me. Here is the javascipt.
    <script language="JavaScript" type="text/javascript">
    function checkMissing(formItem,formItem2)
    var t1 = document.getElementById(formItem).value;
    if (t1 != null)
      conmod = confirm("There is/missing parts, Do you wnat to continue to close the seesion?");
      if (conmod == true)
       document.getElementById(formItem2).value = "CLOSE";
       doSubmit();
      else if (conmod == false)
        document.getElementById(formItem2).value = 0;
      else
       document.getElementById(formItem2).value = "CLOSE";
       doSubmit();
    </script>

  • How to determine from PL/SQL which processes are running

    Hi,
    I would like to find out which processes are runing. Is there any way how to determine this directly from PL/SQL? I know I can run external C libraries, but if there is another way, that would be great.
    Thanks for help, Dan

    Rahul India wrote:
    YOu might want to check these
    http://www.dba-oracle.com/plsql/t_plsql_v$.htm
    http://www.dba-oracle.com/t_plsql_monitoring.htm
    Please DO NOT post links to commercial websites. It is a breach of the Terms of Use of the forums.
    Such websites tend to provide snippits or excerpts of information in order to try and get people to purchase their products (books or whatever) or services.
    There are plenty of good resources out there, including the Oracle documentation, other threads on these forums with similar questions and solutions, or expert's blogs or websites that are not trying to sell something.

  • Javascript Confirm box dependent on results of query

    Hi
    I'm using Apex version 3.2.1 and I'm looking for a way to do the following, any help much appreciated:
    A javascript confirm box will appear when the user submits a page if the result of a query returns anything, the query would look something like this....
    SELECT * FROM LINKEDPROJECTS
    WHERE ENV_ID = :P18_ENV_ID
    AND COMP_ID = :P18_COMP_ID
    AND DATE_FROM <= to_date(:P18_DATE_TO, 'DD-MON-YY')
    AND DATE_TO >= to_date(:P18_DATE_FROM, 'DD-MON-YY')
    If it doesnt return any data the page will submit as normal, if it does return any data the confirm box will appear, and the message will also be driven by the result of a query.
    So the message would be something like....
    Project(s) +"Select NAME FROM PROJECTS WHERE ID IN (SELECT PROJ_ID FROM LINKEDPROJECTS WHERE ENV_ID = :P18_ENV_ID+
    +AND COMP_ID = :P18_COMP_ID+
    +AND DATE_FROM <= to_date(:P18_DATE_TO, 'DD-MON-YY')+
    +AND DATE_TO >= to_date(:P18_DATE_FROM, 'DD-MON-YY')"+ have this environment booked on the dates you selected.  Do you want to continue with the booking?
    Selecting yes submits the page, selecting no returns them to the page.

    In a nutshell (and some pseudo code):
    The button URL would look something like "javascript:beforeSubmit()" without quotes and where beforeSubmit is the name of your function.
    The function would look something like:
    function beforeSubmit() {
      var runQuery = new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=RunTheQuery',1);
      var result = runQuery.get();
      if (result = 0) {
        if (!apex.confirm('Submit page?")
          return;
      doSubmit('SUBMIT');
    {code}
    The application process, called "RunTheQuery" in this example, is a PL/SQL block that runs the query and return the value using the htp.prn function.
    There are probably errors in the above as I just did this off the top of my head, and you will probably need to tweak it somewhat.  But hopefully you get the idea.
    Mark                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Problem setting a hidden item value when button clicked with dynamic action or pl/sql process

    Apex 4.1
    Oracle 11g
    I have a page that consists of a main region and several sub regions.  I have a pl/sql process in After Header SET_DISPLAY(:P400_DISPLAY :='MAIN';)
    Three subregions have a contional display where P400_DISPLAY = STORE.  This works in hiding the sub regions.
    Now I want to change the P400_DISPLAY value to STORE to show the subregions when I hit a button.
    I tried creating a dynamic action for on click of the add button but get the following error:
    The selected button uses a 'Button Template' that does not contain the #BUTTON_ID# substitution string
    I went to the templates and found:
    Substitution Strings
    Substitution strings are used within sub templates to reference component values. This report details substitution string usage for this template.
    Substitution String
    Referenced
    From
    Description
    #LINK#
    Yes
    Template
    To be used in an "href" attribute
    #JAVASCRIPT#
    No
    To be used in an "onclick" attribute
    #LABEL#
    Yes
    Template
    Button Label
    #BUTTON_ATTRIBUTES#
    No
    Button Attributes
    #BUTTON_ID#
    No
    Generated button ID will be either the button's Static ID if defined, or if not will be an internally generated ID in the format 'B' || [Internal Button ID]
    I then tried creating a page process, pl/sql, :P400_DISPLAY :='STORE'; when the appropriate button is pressed.  The button action is submit page. However, it does not change the P400_DISPLAY value and the subregions stay hidden.
    Suggestions please on how to fix the template or change the P400_DISPLAY value?

    The root issue is that, although you change the value of your page item, it isn't visible to other areas of the page until it is in the session. So, any other action based on the value of your page item; the visibility of a control, a report based on the item's value, etc. will all be unaffected by changing the value of the page item until it has been changed in the session. Even after this the items are stored in the session, you must thereafter do something to cause the value to be reevaluated. To see the effect of this, observe that your page loads and evaluates the value of your page item, it sees that is "MAIN" and hides the regions. However, it doesn't reevaluate them after this.
    So; your choices to get this value set in the session are to either Submit the page, or use JavaScript to set the value in the session. If you use the latter of these, you'll have to do some further work to cause the visibility tests to be re-run, So, let's stick with with the submit method.
    What you've done above sounds correct for this but, there are a lot of decisions you could have made that might have caused things not to happen in the correct sequence.
    Firstly, let's confirm that what I describe above is your problem. From the development environment, load the page, click the button to change the value and submit. Now, click the link labelled Session. Is it still set to MAIN? If so; this is your issue.
    Let's start with the your After Header computation. Did you set it to *only* run if the current value of your page item is NULL??? If not, that's your problem.
    Load Page -> Item set to 'Main' by Computation -> Click Button -> Item set to STORE -> Submit -> Load Page -> Item set to 'Main' by Computation
    See the problem?
    Assuming this isn't the issue, you created a Branch to the same page, right? What is your process point for the Branch? Is it *After* Validation, Computation etc? Because if not, you aren't changing the value before the submit happens.
    I bet it is the first issue but, take a look at these.
    Cheers,
    -Joe

  • Display A Success Message From An Application Process

    Apex 3.2
    I have an on demand application process, which is resetting my application, except application items
    BEGIN
       FOR c IN (SELECT page_id
                   FROM apex_application_pages
                  WHERE application_id = :app_id)
       LOOP
          apex_util.clear_page_cache (c.page_id);
       END LOOP;
    :F270_REFRESH_INTERVAL := null;
    END;
    I have a list item that calls some javascript on page zero
    <script type="text/javascript">
    function resetapp(){
    var answer=confirm("Do you really want to reset the application ?");
    if(answer==true) {
    var get = new htmldb_Get(null, null, 'APPLICATION_PROCESS=RESET_APPLICATION');
    var gReturn = get.get();
    redirect('f?p=&APP_ID.:1:&APP_SESSION.');
    </script>
    The user clicks on the item in the list. A confirmation appear and when they click ok,
    then the on demand process runs and they are directed to page 1.
    This is all working ok.
    My problem is that I would like to display a message (a sucesss message) on page 1.
    I have an unconditional branch on page 1 with the tick box checked for include process message.
    I have tried the following in my application process, but none seem to work.
    apex_application.g_print_success_message := 'Application Has Been Reset';
    htp.prn('Application Has Been Reset');
    HTP.P('Application Has Been Reset');
    How can I do this ?
    Gus

    Can anyone help ?
    Gus

  • Calling JS function in pl/sql process

    Hello!
    I have a js function defined in 'HTML Header' :
    <script language="JavaScript" type="text/javascript">
    function disp_alert()
    alert("Data is invalid! Correct the data and click CONFIRM again.")
    </script>
    I also have a pl/sql process on this page. I want to call disp_alert function in a following way:
    if ... then call function
    else dbms_output.put_line('...');
    end if;
    How can I call this js function in 'if'??
    Tom

    There ARE ways to accomplish something like this, but they're much more complex.
    You must create a JavaScript that uses APEX's built in AJAX components; a form button will call the JavaScript, which will in turn call a PL/SQL procedure saved as an "On Demance Shared Application Process." This procedure can run any checks you like against the DB, and return data to the Javascript to display in an alert.
    You can see an example of this in use at an APEX page I created: http://htmldb.oracle.com/pls/otn/f?p=19864:5
    This isn't the same thing, but is accomplishing what it does through an APEX form, a javascript call on the text field to a PL/SQL Process that returns rows from the database dynamically...thus allowing the client side JavaScript to call server side PL/SQL.

  • How do I migrate views from MS SQL 2008 to Oracle 11g through SQL Developer

    Is there any way to migrate the views from MS SQL 2008 to Oracle 11g through SQL Developer? Please give me some detail steps. Thanks for your help.
    Kevin

    Hi Kevin,
    user13531850 wrote:
    Hi Turloch,
    When I use migrate to oracle, I got a problem, the migrate tool create a new schema for me in my case (AZTECA_KSMMS), it migrates all the stuffs under that schema (AZTECA_KSMMS). However my application need the all the Oracle data under schema AZTECA instead of AZTECA_KSMMS. Is there any way to specify specific schema (AZTECA) for target oracle database? Schema remapping is available:
    First Capture (separately) then during right click convert on the captured model there is a Specify the conversion options with a Object Naming tab where the schema (and other) name changes are editable.
    I have not used this recently.
    Also during the migration process, when I choose repository, there is a check box for truncate to reset repository to empty state, Do I need to check that truncate Check Box so the repository will be cleared from last migration?The repository can hold multple migration attempts. Check truncate to get rid of previous attempts information. This cleans up the repository - not the destination database.
    There are also online database and offline database options during the migration process, what are the difference between these two choices? After I migrated to Oracle, all my views has a red cross icon next to it. Does that mean the view migration is failed or not? Please give me your comments. Thanks for your help.offline: for big (amount of data) databases with simple data types,
    uses bcp + files + scripts + sqlldr.
    online: for small (amount of data) databases (easier),
    uses (Java) jdbc.
    The view is likely to be broken - recompiling it may help.
    The Oracle schema is created using a .sql file - see under generated in the directory you gave originally in the wizard. There is a .out file that contains the result of running this script including any errors. During conversion there are also likely to be warnings displayed on the UI.
    There may be a single issue that is causing multiple issues - if viewa depends on functionb, and functionb is broken, viewa will also fail.
    >
    Kevin-Turloch
    SQLDeveloper Team

Maybe you are looking for

  • Working in Debug mode, not after building the installation.

    Hi, I have a button to launch a form. When I test it in debug mode, it works fine. But, after making installation, if I do the same thing (press the button), I'm getting the following error: Unexpected end of file while parsing name has occured. Line

  • XI - Call Adapter Error - HTTP client. Code 402 reason ICM_HTTP_TIMEOUT

    I am using HTTP adapter to post XML PO to vendor's site. We are having this problem with one of our vendor when PO's has more than 15 line items. XI server is getting error-"Call Adapter Error - HTTP client. Code 402 reason ICM_HTTP_TIMEOUT". Actuall

  • Add a button inside textfeild

    We use Forms 6i. Can I make a bean that "extends vTextField" and add a button inside the textfield? So that when I add the bean in implemenation class of a textfield, I can have a small button inside and after I click it, I can do what I want. Thx

  • Ipad air setup via icloud restore - can't finish

    Hi all I've got new Ipad Air and yesterday I started restore from icloud. Source was Ipad mini backup. After 3 hours more or less all apps were there, I had some mixup in newsstand but nothing serious. Everything seems to be working, yet in the setti

  • DV7-1220ed BIOS disk test fails in full test (hangs). Is this the disk or the controller?

    Hi, my DV7-1220ed started failing with BSOD after I used CCcleaner software. I decided to reinstall the PC, but still there seems to be a problem with the disk. Sometimes it stalls, and then I can see the disk light on almost constantly and you can