Hello Everybody
I am creating a website using asp.net and vb.net, I am a beginner so please need your help
I have 4 radiobuttons...Yes1,No1,Yes2,No2
If user clicks N01,No2 or any No radio button, I need to display message saying do u want to go back and 2 buttons...1 says YES and other button says No, go back....I want to achieve something like sweetalert(which i really dont know how to)
(http://t4t5.github.io/sweetalert/ ----by passing a parameter, you can execute something else for "Cancel)
If it says yes then send an email and close the browser.
If it says No, go back then load the page.
But before showing the dialogue box, it has to wait for the user to check radiobuttons of 2groups, I mean if user clicks No1, but doesnot click anything on Yes2 and No2, the message should not be displayed, the popup message should come up only when both the groups of radiobutton have been checked.
I have written the below code but that doesnot satisfy my condition, any no is clicked message comes up.
<script type="text/javascript">
function confirmExit() {
document.getElementById('<%= hfSendMail.ClientID%>').value = 'No';
var resp = confirm("You have answered No to one or more of the identification questions,Are you sure you want to Exit?");
if (resp == true) {
document.getElementById('<%= hfSendMail.ClientID%>').value = 'YES';
}
}
</script>
<asp:HiddenField ID="hfSendMail" runat="server" />
<tr class='welcome'><td class='centre'><span>My Name is:</span><br /><strong> <asp:Label ID="Label1" runat="server" Text=" Jones"></asp:Label></strong></td><td><span>Correct?</span>
<a class="tooltip"><img src="info.png" /><span><strong>Your Name</strong><br />Sorry if it's not exactly correct to identify you.</span></a><br /> <asp:RadioButton ID="RadioButton1" runat="server" Text="Yes" TextAlign="Left" GroupName="namegroup" AutoPostBack="True" /><asp:RadioButton ID="RadioButton2" runat="server" Text="No" TextAlign="Left" GroupName="namegroup" onchange="confirmExit();" AutoPostBack="true" /></td><td class='centre'><span>The Location <br /> Information is:</span><br /><strong>
<asp:Label ID="Label2" runat="server" Text="Africa"></asp:Label></strong></td><td><span>Correct?</span>
<a class="tooltip"><img src="info.png" /><span><strong>Address</strong><br />Click 'Yes' if this identifies your location.</span></a>
<br /> <asp:RadioButton ID="RadioButton3" runat="server" Text="Yes" TextAlign="Left" GroupName="locationname" AutoPostBack="True" /><asp:RadioButton ID="RadioButton4" runat="server" Text="No" TextAlign="Left" GroupName="locationname" AutoPostBack="true" onchange="confirmExit();" /></td></tr>
<tr><td colspan='4' class='hrr'></td></tr>
</tbody>
Protected Sub RadioButton1_CheckedChanged(sender As Object, e As System.EventArgs) Handles RadioButton1.CheckedChanged
If (RadioButton3.Checked) Then
Response.Write("")
If (RadioButton4.Checked) Then
Response.Write("")
End If
End If