I am faced with a scenario where a user has chosen a product, the system has retrieved the product record, and the backorder flag has been set. I need to inquire if the user still wants to proceed with including the product in the order. However, I am struggling to find a clear example of implementing this within an IF statement.
Here is my snippet of VB Code:
Dim backorder = myDataTable.Rows(0)("backorder").ToString()
If backorder = "True" And <somehow prompt the user about including it in the order> Then
'do something
End If
And here is my JavaScript code in the ASPX file:
<script type = "text/javascript">
function Confirm() {
var confirm_value = document.createElement("INPUT");
confirm_value.type = "hidden";
confirm_value.name = "confirm_value";
if (confirm("Selected item is on temporary back order. Do you want to include it on this order?")) {
confirm_value.value = "Yes";
} else {
confirm_value.value = "No";
}
document.forms[0].appendChild(confirm_value);
}
</script>
I can retrieve the variable added by JavaScript to the page in VB, but I am having trouble understanding how to trigger the JavaScript function to prompt the user. Any guidance or examples would be greatly appreciated.