Note that there are some explanatory texts on larger screens.

plurals
  1. PO'Do you accept the terms and conditions?' on Log In Forms Authentication MVC3
    text
    copied!<p>I'm struggling with having a login dialog box appear on login. What I need to happen is when the user logs in using the built in MVC3 authentication controls, I need it to pop up a dialog that spits out some terms and agreements, and says "if you hit accept, you agree to the above". I currently have that, but when I hit cancel, the site will still log in anyway. Here is my code:</p> <pre><code>&lt;fieldset&gt; &lt;legend&gt;Login&lt;/legend&gt; &lt;div class="editor-label"&gt; @Html.LabelFor(model =&gt; model.userName) &lt;/div&gt; &lt;div class="focus"&gt; &lt;div class="editor-field"&gt; @Html.EditorFor(model =&gt; model.userName) &lt;/div&gt; &lt;/div&gt; &lt;div class="editor-label"&gt; @Html.LabelFor(model =&gt; model.passWord) &lt;/div&gt; &lt;div class="editor-field"&gt; @Html.PasswordFor(model =&gt; model.passWord) &lt;/div&gt; &lt;p&gt; &lt;input type="submit" value="Login" name="btnLogin" id="btnLogin" /&gt; &lt;/p&gt; @Html.ValidationSummary(true) &lt;/fieldset&gt; </code></pre> <p>And the Javascript that I have:</p> <pre><code> &lt;script type="text/javascript"&gt; $(function () { $("#btnLogin").click(function () { var answer = confirm("Unauthorized access or use of the web content is prohibited.\n" + "By clicking 'OK', you have agreed to the above conditions"); if (answer) { } else { $(this).dialog("close"); } }); }); &lt;/script&gt; </code></pre> <p>How would I get it to just cancel the HttpPost on login when the user hits cancel on the dialog and continue to login if they hit ok?</p> <p>Much appreciated!!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload