Hello Bytes:
Here's a continuation of my dilema :)
Now it works fine but Im planning to put more functionality on my JS script so Im planning to have a 'header JS' to call the subs functions. The problem is that it do call the the sub function but it let the browser go to the next page even though the condition didn't pass to return true. Please help. Thanks in advance!
The button Form
header function
sub function
Here's a continuation of my dilema :)
Now it works fine but Im planning to put more functionality on my JS script so Im planning to have a 'header JS' to call the subs functions. The problem is that it do call the the sub function but it let the browser go to the next page even though the condition didn't pass to return true. Please help. Thanks in advance!
The button Form
Code:
<form method="post" name="recapform" action="tblevent_entry_recap_handler.php?id=<?php echo $_GET['id'];?> " onsubmit="return show_alert()">
Code:
<script type="text/javascript">
function show_alert()
{
entity_alert();
}
</script>
Code:
<script type="text/javascript">
function entity_alert()
{
x= parseInt(document.getElementById('Organization').value)+parseInt(document.getElementById('Agencies').value)
+parseInt(document.getElementById('Education').value)+parseInt(document.getElementById('Medical').value)+parseInt(document.getElementById('Business').value)
+parseInt(document.getElementById('Professional').value)+parseInt(document.getElementById('Government').value)+parseInt(document.getElementById('Residential').value)
+parseInt(document.getElementById('ResidentialFacility').value);
y = parseInt(document.getElementById('ActualAttendees').value)
if (x>y)
{
alert ('Entity is over by:' + (x-y));
return false;
}
else
{
return true;
}
}
</script>
Comment