0

Hello:

I would like to get confirmation from user, if a particular checkbox on form is not checked, whether they want to submit the form without checking this box.

I have written the following, but need help with it --missing something.

<script type="text/javascript">
function taxable(){

if (document.processEstimate.tax.checked == 0) 
    {
if (confirm('You have not checked the taxes. Are you sure you want to continue?')) document.processEstimate.submit(); else return false; 
    } 
else 

document.processEstimate.submit();
};
</SCRIPT>

and then

<form name="processEstimate" .... .... onsubmit="return taxable();">

Not working so far. Is this correct or is there a better way?

Thank you!
Mossa

1
Contributor
2
Replies
4
Views
5 Years
Discussion Span
Last Post by mbarandao
0

here is a working code:

function validateprocessEstimate()
{
var focus_me = null, msg = "";

if (document.processEstimate.taxbox.checked == 0) 
{
msg += " ";
focus_me = focus_me || processEstimate.taxbox[0];
//}
if (msg != "")
{
var prefix = "\nSales Taxes were not added!\n";
var suffix = "\nClick OK to add and re-submit.\n";
var suffix = suffix + "\ Or click CANCEL to continue without Taxes."
var ask = confirm(prefix + msg + suffix);

if (ask) 
{
    if (focus_me)   
    {
        focus_me.focus()
    }
    return false;
}

else 
{
document.forms.processEstimate.submit();
}
}
}
else 
{
document.forms.processEstimate.submit();
}
}

and then

handlers:

<a href="#" class="classname" onclick="return validateprocessEstimate() && document.forms['processEstimate'].submit(); return false;">Print & Save</a>  
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.