I am working on a MVC asp.net project and I have a created a button that when click, I need a confirm box to pop up and say "Yes" and "No" and possibly cancel.
My code is below
if (Model.AStatusId == AssetManager.Utility.AMConstants.AssetStatus_Deployed)
{
<div class="col-sm-12 text-center m-t-20">
<input type="submit" class="btn btn-success" value="Check In"
onclick="return ValidateCheckInAsset();" />
</div>
}
<script>
function ValidateCheckInAsset() {
var label = "";
var flag = 0;
if ($("#SourceID").val().length == 0) {
label += "Are you sure you want to Check In? \n";
flag = 1;
}
if ($("#TrackingNumber").val().length == 0) {
label += "Are you sure you want to Check In?";
flag = 1;
}
if (flag == 1) {
alert(label);
return false;
}
else
return true;
}
</script>
At the moment is displaying an alert label, which I am using for a different button so I know this isn't my solution but I am having problems creating the actual confirm query.
Any help would be very much appreciated.