control editor input format
control editor input format
Hi All,
I am new to editor, here is a simple question, how to control the text input max length, I can not seem to find a document to mention this.
What I want is:
[code]
{
"label": "Code:",
"name": "code",
"type": "text",
"maxLength": "4"
}
[/code]
is there a maxlength attribute available?
Thanks a lot.
Tiger
I am new to editor, here is a simple question, how to control the text input max length, I can not seem to find a document to mention this.
What I want is:
[code]
{
"label": "Code:",
"name": "code",
"type": "text",
"maxLength": "4"
}
[/code]
is there a maxlength attribute available?
Thanks a lot.
Tiger
This discussion has been closed.
Replies
There actually isn't a Javascript API to add that option to the text input at the moment, although that is something that will be introduced in the next version of Editor, including the ability to specify `email` etc type input options.
At the moment what you could do is use the `onOpen` event and add the attribute to your input element. For example:
[code]
editor.on( 'onOpen', function () {
// Get the 'input' element from the 'code' input field and set an attribute on it
$( 'input', this.node( 'code' ) ).attr( 'maxLength', 4 );
} );
[/code]
Regards,
Allan