Welcome Guest, Not a member yet? Register   Sign In
Prevent the use of symbols
#7

[eluser]nuwanda[/eluser]
It's not about being lazy. It's really a matter of UI design philosophy. If your inputs have good instructions in the first place (see stackoverflow's system), and your validation messages are good, most users wouldn't need to submit a form more than twice to get it done.

That said, I think client-side validation can be helpful if you don't a) overuse it, and b) rely upon it.

Anyway, here's a little jQuery I use to reject characters in inputs:

Code:
$('#input').keyup(function(){
    this.value = this.value.replace(/[^0-9a-z\s-]/g,'');
});

That takes the current value of the input, and replaces the regex of unwanted characters with an empty string. To the user it looks like their input didn't happen.

In the above, anything that is not lowercase alphanumeric, a space, or a dash is rejected.


Messages In This Thread
Prevent the use of symbols - by El Forum - 11-24-2010, 06:41 PM
Prevent the use of symbols - by El Forum - 11-24-2010, 07:06 PM
Prevent the use of symbols - by El Forum - 11-24-2010, 07:57 PM
Prevent the use of symbols - by El Forum - 11-24-2010, 07:59 PM
Prevent the use of symbols - by El Forum - 11-25-2010, 03:03 AM
Prevent the use of symbols - by El Forum - 11-25-2010, 10:37 AM
Prevent the use of symbols - by El Forum - 11-25-2010, 03:41 PM
Prevent the use of symbols - by El Forum - 12-06-2010, 11:27 PM
Prevent the use of symbols - by El Forum - 12-07-2010, 01:57 AM



Theme © iAndrew 2016 - Forum software by © MyBB