Confirmation Pop-Up Web Matrix

Results 1 to 2 of 2

Thread: Confirmation Pop-Up Web Matrix

  1. #1
    Join Date
    Dec 1969

    Default Confirmation Pop-Up Web Matrix

    I am using code found on the web to get confirmation of Yes/No from a javascript pop-up and display the result on an .aspx page. I am using a hidden control defined as follows <BR><BR>&#060;input type="hidden" id="hdnbox" runat="server" &#062;<BR><BR>The following JavaScript sits between langiage tags below all other code:<BR><BR>function getMessage() <BR>{ <BR>var ans; <BR>ans=window.confirm(&#039;Is it your confirmation.....?&#039;); <BR>//alert (ans); <BR>if (ans==true) <BR> { <BR> alert(&#039;Yes&#039;); <BR> document.Form1.hdnbox.value=&#039;Yes&#039;; <BR> } <BR>else <BR>{ <BR> alert(&#039;No&#039;); <BR> //document.Form1.hdnbox.value=&#039;No&#039;;} <BR> document.Form1.elements[&#039;hdnbox&#039;].value="no";<BR> __doPostBack} <BR><BR>}<BR><BR>The confirm box executes fine; that is the "Yes" and "Cancel" buttons function as intended. The problem is that the value of hidden control ("hdnbox") does not get set to "Yes" or "No" as the code implies. To test this, I establish an initail value in Page_Load (Not PostBack), then attempt to read it in "Sub Button1_Click" using: "Response.Write( "Request.Form("hdnbox"))" ). Its value remains unchanged.<BR><BR>I have tried everything I can think of to make this work. Some advice would be most appreciated.<BR><BR>Thank you.<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Confirmation Pop-Up Web Matrix

    That code&#039;s fine. It changes the value for me.<BR><BR>Make sure that the hidden field is in a form named Form1, and that you&#039;re not getting any other Javascript errors on the page that are stopping execution anywhere. If it&#039;s not changing the value, you should see a JavaScript error on the page.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts