Hi,
Well, I must say... I copied your code but only changed as following
(to save myself writing the conversion functions):
function convertToNumeric(objFld)
{
objFld.value="9700012";
}
function convertToCurrency(objFld)
{
objFld.value="$97,000.12";
}
And it didn't loop endlessly...
2 options:
1) Your conversion function is looping endlessly
2) In any case, you can always write a validation function like
ValidateIsNumeric and add a little IF statement in you
convertToNumeric function to appear like this:
function convertToNumeric(objFld)
{
if (!ValidateIsNumeric(objFld.value))
{
objFld.value=CurrencyToFloat(objFld.value);
}
}
This might also increase performance on your client browser slightly
if the conversion is a painfull one, just use regular expressions to
make sure there are only digits there...
The loop will still be there I guess but who knows... You can also
send me your actual conversion functions and I'll have a look, we
might also be able to manipulate it with the onkeypress event.
Best of luck!
masoud bayan - 15 Dec 2004 16:31 GMT
Hi,
Thanks for your reply.
Well, you are right it is working properly.
My mistake : I was testing application in debug mode so each time onfocus
was called and application stopped at breakpoint then when I hit run and
went back to application onFocus function was called and it caused and
endless loop.
Thanks again for your follow up.
Masoud
> Hi,
>
[quoted text clipped - 41 lines]
> www.GroupSrv.com
> *-----------------------*