Issue:
I am facing a problem with the confirmation box that appears when I click on the save button. It saves the data correctly when I click OK, but when I click cancel, it doesn't cancel the changes and still saves them. Can you assist me in resolving this problem?
Below is the JavaScript code for reference:
/
<asp:Button ID="view_btn_save" Text="Save" ValidationGroup="view" OnClick="view_btn_save_click"
OnClientClick="Validate_view()" runat="server"
/>
</td>
<script type="text/javascript">
function Validate_view() {
var value = document.getElementById('<%=view_txt_name.ClientID%>').value;
var value2 = document.getElementById('<%=view_txt_title.ClientID%>').value;
var value3 = document.getElementById('<%=view_txt_description.ClientID%>').value;
var value4 = document.getElementById('<%=view_txt_pixelwidth.ClientID%>').value;
var value5 = document.getElementById('<%=view_txt_pixelheight.ClientID%>').value;
if (value == '' || value2 == '' || value3 == '' || value4 == '' || value5 == '') {
return alert('Please enter the missing fields');
}
else {
return confirm('Confirm changes?');
}
}