Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I have been trying to solve this problem for 3 days now. What happens is that if insertStatus==true, then the insert query will trigger without trying the if statement from my Javascript.For instance, if the user press the submit button(which is another jsp file),the window.confirm windows appears, but if I check the database, entries are already inserterted without trying the if statement from my Javascript.
Any help is appreciated.
Thanks,
---------------
<% if (insertStatus==false){ %><script language="Javascript">
alert("Error: Some values were not selected or some values were not recognized")
history.go(-1)
</script>
<%}
else {
%>
<script language="Javascript">
var p=window.confirm("Total amount is $"+<%=dollars%>+", Continue?")
if (p == true) {
alert("Entries will be inserted to the Database")
<%
stmt = "insert into orders values("+ordno+",'"+month+"',"+"'"+cid+"',"+"'"+aid+"',"+"'"+pid+"',"+qty+","+dollars+")";
insertStatus = myCBean.updateTable(stmt);
if (insertStatus){
%>
document.write("Entries successfully inserted")
<%}
else { %>
document.write("Error while trying to insert values")
<%}%>
}
else {
<% insertStatus = false;%>
history.go(-1)
}
</script>
<%}%>

![]() |
Alternative Download For ...
|
MusicMatch: Multiple User...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |