yes/no box in classic asp RRS feed

  • Question

  • User1512591681 posted


    I have a report that is generated every week.  The first run of the report stores the resulting calculations in a table.  Each run after that should match the stored value.  All of this works great.  The problem is when someone changes the data and the report needs to update the stored value.  Currently I have the program printing a message that says the stored value itemarray(5,i) does not match the calculated value of 26.  Please contact Jack to fix the value.  I would rather have the program ask the user if they want to update the stored value.  If yes then update and continue processing else response.end.  I can't figure out how to get a message box to ask the user the question of Do you want to update the store value of itemarray(5,i)?  Can someone please point me in the right direction?

    Thank you.

    Tuesday, September 1, 2020 8:19 PM

All replies

  • User-848649084 posted


    You could try the below code:

    <script language="Javascript">
     function doUpdate(id) {
                var confirm_value = document.createElement("INPUT");
                confirm_value.type = "hidden";
                confirm_value.name = "confirm_value";
                if (confirm("Do you want to save data?")) {
                    confirm_value.value = "Yes";
                } else {
                    confirm_value.value = "No";
     <form id="form1">
    Now you can pass the id as follow:
    <input type="Button" name="delete" Value="Update" OnClick="doUpdate('<%=id%>')">

    Set the relevant code based on your requirement in function. 

    Wednesday, September 2, 2020 3:23 AM
  • User1512591681 posted

    Thank you for the code.  While the code works, it doesn't work the way I need it too.  It doesn't pause the loop waiting for the answer.  When I run test.asp I see:

    not itnot itnot itnot itnot it
    Now you can pass the id as follow: Update button not itnot itnot itnot itnot itnot it

    <% Dim id, i
    id = "jake" 
    For i = 0 to 10
    If i = 5 Then%>
    <form id="form1">
    Now you can pass the id as follow:
    <input type="Button" name="delete" Value="Update" OnClick="doUpdate('<%=id%>')">
    End If
    If strcomp(id,"Yes",1) = 0 Then
      response.write "it"
      response.write "not it"
    End If 
    Next %>

    Thursday, September 3, 2020 7:18 PM
  • User1512591681 posted

    I worked around the problem.  The first run through shows the report and highlights any inconsistencies.  If there are inconsistencies a red button is added at the bottom asking if the user wants to update the stored values.  If they click the button, a flag gets set, the form calls the same page and the page sees the flag and knows to update the stored values.

    Tuesday, September 8, 2020 1:56 PM
  • User-848649084 posted

    If your issue is solved then I request you to mark the helpful suggestion as an answer. This will help other people who face the same issue.

    If your issue still exists then try to refer the solution given by the community members.

    If then also you have any further questions then let us know about it.

    We will try to provide further suggestions to solve the issue.

    Thanks for your understanding.

    Wednesday, September 9, 2020 8:53 AM