Welcome Guest, Not a member yet? Register   Sign In
Form validation error message for length validations
#1

[eluser]helmutbjorg[/eluser]
I'm using the form_validation library to test for min_length, max_length, and exact_length and the following error messages are being returned...

Code:
The title field must be at least 200 characters in length.
The title field can not exceed 200 characters in length.
The title field must be exactly 200 characters in length.

This is good. But not great. It is better in these sort of error messages to give the user some ideas of how they could fix the problem. Like so...

Code:
The title field must be at least 200 characters in length. You have 140 characters.
The title field can not exceed 200 characters in length. You have 205 characters.
The title field must be exactly 200 characters in length. You have 205 characters.

Now what would be the best way of getting that result? The way error messages are constructed in the form_validation library only allows for max of two '%s' sprintf params.


Messages In This Thread
Form validation error message for length validations - by El Forum - 01-11-2009, 06:48 PM
Form validation error message for length validations - by El Forum - 01-12-2009, 03:19 AM
Form validation error message for length validations - by El Forum - 01-15-2009, 08:44 AM
Form validation error message for length validations - by El Forum - 12-03-2010, 07:41 AM
Form validation error message for length validations - by El Forum - 04-23-2013, 06:27 PM
Form validation error message for length validations - by El Forum - 05-02-2013, 10:42 PM



Theme © iAndrew 2016 - Forum software by © MyBB