We are excited to announce that the IIS.NET Forums are moving to the new Microsoft Q&A experience. Learn more >

yes/no box in classic aspRSS

4 replies

Last post Sep 09, 2020 08:53 AM by Jalpa Panchal

  • yes/no box in classic asp

    Sep 01, 2020 08:19 PM|jacks74|LINK

    Hello,

    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.

  • Re: yes/no box in classic asp

    Sep 02, 2020 03:23 AM|Jalpa Panchal|LINK

    Hi,

    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";
                }
                document.forms[0].appendChild(confirm_value);
            }
    </Script>
    
     <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. 

    .NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
  • Re: yes/no box in classic asp

    Sep 03, 2020 07:18 PM|jacks74|LINK

    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"
    Else
      response.write "not it"
    End If 
    Next %>

  • Re: yes/no box in classic asp

    Sep 08, 2020 01:56 PM|jacks74|LINK

    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.

  • Re: yes/no box in classic asp

    Sep 09, 2020 08:53 AM|Jalpa Panchal|LINK

    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.

    .NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.