Author Topic: How to control the input characters in a field?  (Read 2571 times)

lsl

  • Pro Deluxe
  • Jr. Member
  • *
  • Posts: 67
    • View Profile
How to control the input characters in a field?
« on: June 06, 2015, 07:09:02 am »
If there are two fields in a grid. The first is Currency Code which is 3 characters and the second is Currency Name which is 30 characters. Is there a way to control not allow user to input more characters then the fields length. ie. if user try to input the fourth characters in Currency Code, it will not allow to do so.

On the other hand, it will be printed out from the memo field of a grid. However, the space is only to allow printing 10 rows. Can I control the memo field not more than 10 rows?

Thanks.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6282
    • View Profile
Re: How to control the input characters in a field?
« Reply #1 on: June 08, 2015, 03:17:46 pm »
1) column.editor.attr property could be used to limit the number of input characters in editor.

attr: "maxlength='3'"

2) Set wrap: false for the grid, use textarea as the editor, use callback validation and count the number of newline characters inside the callback, return false when number of newlines characters exceed 10.