Error "Data too long for column…"

QuestionsError "Data too long for column…"
pierre mata asked 8 years ago

Hello, if i have a field: varchar(10), the program let me capture 11 or more, but when i save, send me the next message :"Data too long for column…", how limit the number of characters when capture? thanks.

3 Answers
Abu Ghufran answered 8 years ago

Hi,

With that specific column settings, you can set:

$col["editoptions"]["maxlength"] = "10";

editoptions array is mapped to input field attributes.

pierre mata answered 8 years ago

Hello Abu, there's a option for limit the number of characters in capture time??? thanks

Abu Ghufran answered 8 years ago

This code:
$col["editoptions"]["maxlength"] = "10";
is exactly for this reason. It won't let you enter 11th character in input field.

Alternatively, you can have JS-validation on that field and stop submitting form.
Refer demos/editing/js-validation.php

Your Answer

18 + 5 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?