Skip to Content
author's profile photo Former Member
Former Member

Problem - JavaScript Confirm For PopUp Not Working

Dear All,

I was trying for one popup depending on some condition in View of BSP. The popup doesn't pop on the web page. With debugging I found that the debugger simply pass on from the confirm function. And on web page status bar a warning icon appears.

I am using MVC pattern for the development.Kindly let me know what I am missing here.

<script language="JavaScript" type="text/javascript">

function ConfirmChoice2()


var answer.

answer = confirm("Do You Want To Continue?");

<%= W_POPUPVAL %> = answer;











Sapna Modi

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Posted on Feb 01, 2005 at 03:35 PM

    Hi Sapna,

    have a look at the following thread (the part written by Brian McKellar). There the basic parts of using Javascript variables in BSPs were explained.




    Add a comment
    10|10000 characters needed characters exceeded

    • Sapna,

      We are not going to get past the fact that to really do great things, you will unfortunately at the end of the day have to invest time to understand this technology.

      We have now invested time in your problem. One day you must return the investment!

      Some short comments:

      (1) There is no <form> sequence.

      (2) "IF flag = 'TRUE'" will fail because the value is actually 'true'. Very subtle. Change code to be "IF flag CS 'TRUE'". Look in ABAP online help to what does CS (Contain String) do.

      (3) After the confirm() JavaScript code, you need to actually return to server with the answer. This is done by submitting the form. (You now did add one?)

      Below is a complete example for you to play with. Cut and paste this example onto one BSP page. Save. Activate. Fetch coffee. Close door. Gime 10 points. Test. Test. Do not leave the computer for one hour.

      It is not complex. But it is also not easy. Hang around!


         <form name=myFrm>
          <%-- add here request counter, just to see interaction --%>
          <% DATA: counter TYPE STRING.
             counter = request->get_form_field( 'counter' ) + 1. %>
          <input type=hidden name=counter value="<%=counter%>">
          <%-- first question, are we in dirty state. We simulate. --%>
          <input type=submit name=action value="dirty">
          <input type=submit name=action value="clean">
          <% DATA: action TYPE string.
             action = request->get_form_field( 'action' ). %>
          <%-- if dirty, request a pop to confirm --%>
          <input type="hidden" name="save" value="">
          <% IF action = 'dirty'. %>
            <script language="JavaScript" type="text/javascript">
     = confirm("Save?");
          <% ENDIF. %>
          <%-- if we have confirmed state, we save --%>
          <% IF request->get_form_field( 'save' ) CS 'true'. %>
            <span style="color:green">Saved!</span>
          <% ENDIF. %>

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.