I have a form based on a strresult that does a calculation. When a user enters a comma in the coverage_amount field, I get a NaN! calculation. I want to be able to block the comma from being entered, period. Here is a sample if the section I am working on, there is a lot of code, so hopefully this will be enough. Any suggestions would be great!
Cheers!
<!--BEGINNING OF HOME/MOBILE HOME OWNER-->
function ActivateDwelling(territory)
{
divErrorMessages.Print('');
divErrorMessages.Hide();
divEntry.Print('');
divEntry.Hide();
divQuote.Print('');
divQuote.Hide();
divQuoteCondo.Print('');
divQuoteCondo.Hide();
var strResults;
DB1.Coverages.MoveFirst();
DB1.deductable.MoveLast();
strResults = '<table width="600">';
strResults += '<tr>';
strResults += '<td colspan="3">You have select a <font color="#EC1C2D"><b>Home/Mobile Home Owner </font></b> policy for the property located in the <font color="#EC1C2D"><b>' + document.form.zipcode.value + ' </font></b> zip code. <br><br></td>';
strResults += '</tr>';
strResults += '<tr>';
strResults += '<td width="50"><img src="images/step_2.gif" width="50" height="27" alt="Step 2" align="left" valign="middle"> </td>';
strResults += '<td width="200"><input name="coverage_amount" size="7" onKeyUp="FinishDwelling(' + territory + ')"></td>';
strResults += '<td width="350">Enter the <a href="_self" onMouseOver="popLayer(5)" onMouseOut="hideLayer()"><b>Insured Value of your home.</b></a> (Do Not Use Commas)</td>';
strResults += '</tr>';
strResults += '<tr>';
strResults += '<td width="50"><img src="images/step_3.gif" width="50" height="27" alt="Step 3" align="left" valign="middle"> </td>';
strResults += '<td width="200"><select name="dwellingtype" onChange="FinishDwelling(' + territory + ')">';
strResults += '<option value="91_or_later">Framed construction - 1991 or later</option>';
strResults += '<option value="79_thru_90">Framed construction - 1979 - 1990</option>';
strResults += '<option value="78_or_earlier">Framed construction - 1978 or earlier</option>';
strResults += '<option value="all_other">All other construction</option>';
strResults += '<option value="mobile_home">Mobile home</option>';
strResults += '</select></td>';
strResults += '<td width="350">Select the <a href="_self" onMouseOver="popLayer(6)" onMouseOut="hideLayer()"><b>dwelling type of your home.</a></b></td>';
strResults += '</tr>';
strResults += '<tr>';
strResults += '<td width="50"><img src="images/step_4.gif" width="50" height="27" alt="Step 4" align="left" valign="middle"> </td>';
strResults += '<td width="200"><select name="a_deductible" onChange="FinishDwelling(' + territory + ')">';
for(var i = 1; i <= DB1.deductable.Count(); i++)
{
strResults += '<option value="' + DB1.deductable.a_deductible + '">' + DB1.deductable.a_deductible + '</option>';
DB1.deductable.MoveFirst();
}
DB1.deductable.MoveFirst();
strResults += '</select></td>';
strResults += '<td width="350">Please select <a href="_self" onMouseOver="popLayer(7)" onMouseOut="hideLayer()"><b>Coverage A Deductible.</a></b></td>';
strResults += '</tr>';
strResults += '<tr>';
strResults += '<td width="50"><img src="images/step_5.gif" width="50" height="27" alt="Step 5" align="left" valign="middle"> </td>';
strResults += '<td width="200"><select name="coverages" onChange="FinishDwelling(' + territory + ')">';
for(var i = 1; i <= DB1.Coverages.Count(); i++)
{
strResults += '<option value="' + DB1.Coverages.coverage_c + '_' + DB1.Coverages.coverage_d + '">';
strResults += 'C: $' + DB1.Coverages.coverage_c + ' D: $' + DB1.Coverages.coverage_d + '</option>';
DB1.Coverages.MoveNext();
}
DB1.Coverages.MoveFirst();
strResults += '</select>';
strResults += '</td>';
strResults += '<td width="350">Please select Personal Property (C) and Loss of Use (D) <a href="_self" onMouseOver="popLayer(0)" onMouseOut="hideLayer(1000000)"><b>coverages</b></a>.</td>';
strResults += '</tr></table>';
divEntry.Show();
divEntry.Print(strResults);
FinishDwelling(territory);
}
Cheers!
<!--BEGINNING OF HOME/MOBILE HOME OWNER-->
function ActivateDwelling(territory)
{
divErrorMessages.Print('');
divErrorMessages.Hide();
divEntry.Print('');
divEntry.Hide();
divQuote.Print('');
divQuote.Hide();
divQuoteCondo.Print('');
divQuoteCondo.Hide();
var strResults;
DB1.Coverages.MoveFirst();
DB1.deductable.MoveLast();
strResults = '<table width="600">';
strResults += '<tr>';
strResults += '<td colspan="3">You have select a <font color="#EC1C2D"><b>Home/Mobile Home Owner </font></b> policy for the property located in the <font color="#EC1C2D"><b>' + document.form.zipcode.value + ' </font></b> zip code. <br><br></td>';
strResults += '</tr>';
strResults += '<tr>';
strResults += '<td width="50"><img src="images/step_2.gif" width="50" height="27" alt="Step 2" align="left" valign="middle"> </td>';
strResults += '<td width="200"><input name="coverage_amount" size="7" onKeyUp="FinishDwelling(' + territory + ')"></td>';
strResults += '<td width="350">Enter the <a href="_self" onMouseOver="popLayer(5)" onMouseOut="hideLayer()"><b>Insured Value of your home.</b></a> (Do Not Use Commas)</td>';
strResults += '</tr>';
strResults += '<tr>';
strResults += '<td width="50"><img src="images/step_3.gif" width="50" height="27" alt="Step 3" align="left" valign="middle"> </td>';
strResults += '<td width="200"><select name="dwellingtype" onChange="FinishDwelling(' + territory + ')">';
strResults += '<option value="91_or_later">Framed construction - 1991 or later</option>';
strResults += '<option value="79_thru_90">Framed construction - 1979 - 1990</option>';
strResults += '<option value="78_or_earlier">Framed construction - 1978 or earlier</option>';
strResults += '<option value="all_other">All other construction</option>';
strResults += '<option value="mobile_home">Mobile home</option>';
strResults += '</select></td>';
strResults += '<td width="350">Select the <a href="_self" onMouseOver="popLayer(6)" onMouseOut="hideLayer()"><b>dwelling type of your home.</a></b></td>';
strResults += '</tr>';
strResults += '<tr>';
strResults += '<td width="50"><img src="images/step_4.gif" width="50" height="27" alt="Step 4" align="left" valign="middle"> </td>';
strResults += '<td width="200"><select name="a_deductible" onChange="FinishDwelling(' + territory + ')">';
for(var i = 1; i <= DB1.deductable.Count(); i++)
{
strResults += '<option value="' + DB1.deductable.a_deductible + '">' + DB1.deductable.a_deductible + '</option>';
DB1.deductable.MoveFirst();
}
DB1.deductable.MoveFirst();
strResults += '</select></td>';
strResults += '<td width="350">Please select <a href="_self" onMouseOver="popLayer(7)" onMouseOut="hideLayer()"><b>Coverage A Deductible.</a></b></td>';
strResults += '</tr>';
strResults += '<tr>';
strResults += '<td width="50"><img src="images/step_5.gif" width="50" height="27" alt="Step 5" align="left" valign="middle"> </td>';
strResults += '<td width="200"><select name="coverages" onChange="FinishDwelling(' + territory + ')">';
for(var i = 1; i <= DB1.Coverages.Count(); i++)
{
strResults += '<option value="' + DB1.Coverages.coverage_c + '_' + DB1.Coverages.coverage_d + '">';
strResults += 'C: $' + DB1.Coverages.coverage_c + ' D: $' + DB1.Coverages.coverage_d + '</option>';
DB1.Coverages.MoveNext();
}
DB1.Coverages.MoveFirst();
strResults += '</select>';
strResults += '</td>';
strResults += '<td width="350">Please select Personal Property (C) and Loss of Use (D) <a href="_self" onMouseOver="popLayer(0)" onMouseOut="hideLayer(1000000)"><b>coverages</b></a>.</td>';
strResults += '</tr></table>';
divEntry.Show();
divEntry.Print(strResults);
FinishDwelling(territory);
}