Greg Scharlemann wrote:
I'm getting reports (which is all I can go on cause I don't have a mac
or safari browser - new question: can I install safari on a windows
box?) that the javascript at: http://www.perfectlocale.com/standard.php
throws a "you must enter a starting price" alert when using the safari
browser.
Any pro's out there know why that would be the case? The validateForm
function is pretty basic... in fact, I think I consulted this group to
develop it.
Thanks, Greg
It's not unreasonable for the user to be entering commas, which your
function will fail without any explanatory message.
This modified function strips the input of anything but digits and
commas then checks that any commas are positioned correctly.
The input field is modified to show the value under consideration.
Please not that the parameter to this function must be formElement not
formElement.value as yours uses.
(Watch for line wrap)
function isNumber(n)
{
var str=n.value=n.value.replace(/[^0-9\,]/g,'');
return !( !str.length ||
/^\,|\d{4,}\,|\,\d{4,}|\,\d{0,2}(\D|$)/.test(str) );
}
--
S.C.