Oliver wrote:
> I like them to be validated as well, and to short circuit the remainder
> of the field validation.
Feel free to set your validation up that way. Personally, I'd like my
validation code to be smart enough to note when two non-redundant
validation problems occur and to mention both, but to stop at the first
when they are redundant.
For example, a field that is blank should not also trigger a "too short"
error message, but a field that is both too short and contains
prohibited characters should trigger both error messages.
But as I said, the best way is to provide immediate feedback on any
field to indicate when it fails to meet validation *as the user enters
data*, changing to positive indications when the validation rules are met.
> Preventing input of letters rather than digits will introduce some
> pretty nasty and fragile javascript
<HTML>
<HEAD>
<SCRIPT language=Javascript>
<!--
function isNumberKey(evt)
{
var charCode = (evt.which) ? evt.which : event.keyCode
if (charCode > 31 && (charCode < 48 || charCode > 57))
return false;
return true;
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<INPUT id="txtChar" onkeypress="return isNumberKey(event)"
type="text" name="txtChar">
</BODY>
</HTML>
Have yet to find a modern browser in which this didn't work. And this
code can be easily adapted to prevent any specific ANSI characters from
being entered, so you could, for example, have a field that allows only
hexadecimal numbers.
> Audible indications could get annoying
Indeed. But my point was only that visual indications are not the limit.
Not everyone can see.
> Running Ajax calls between fields for validation is pretty ugly,
> javascript validation would be better
That's what I said.
Chas.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Lift" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---