Hi.
The code I''ve got is at http://pastie.caboo.se/134419
The idea is that an input can only contain zero or a +ve numbers to 2 DP.
If not, then the previous value will be shown (which may or may not be
numeric and 2dp).
Basically an ENTERED value must be accurate. Values supplied from the
DB are as is.
The focusing back to the problem input works fine in IE7, but not in FF.
I can''t think of anything that will break this.
I''m using Prototype 1.6.0.1 with a few AJAX mods (nothing in event
handling).
Any ideas?
Regards,
Richard Quadling.
P.S. The code is ...
/* $Id: rechargeEdit.js,v 1.0.15 2008/01/03 14:35:35 RichardQ $ */
document.observe
(
''dom:loaded'',
function()
{
$$(''.EditNumber'')
.invoke
(
''observe'',
''focus'',
function(e)
{
this.writeAttribute(''Before'', this.value);
}
)
.invoke
(
''observe'',
''blur'',
function(e)
{
a_ID = this.id.split(''_'');
if (this.value.length > 0)
{
this.value = parseFloat(this.value, 10).toFixed(2);
if (isNaN(this.value) || (this.value < 0))
{
this.value = this.readAttribute(''Before'');
}
}
if ((''Live'' == a_ID[0]) && (isNaN(this.value) ||
(this.value < 0)
|| (0 == this.value.length)))
{
Event.stop(e);
alert(''Cannot delete prices. Enter 0 for no Recharge.'');
this.focus();
}
}
);
}
);
--
-----
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---