Input field had not maxlength property

Hi, there.
I need to set maxlength of input field but there is no option for this feature.
please help me how can I implement this feature on UI builder.

Hi Top Star,

Welcome to the Backendless Community.

What you ask for is definitely possible. Here’s how you can make it happen:

Suppose this is your input component. Make sure it has an ID assigned to it:

Now, let’s switch to the logic of the Page that contains the component. We need to make sure that logic runs before anything else happens on the page (or you could run it anywhere where it makes sense). I am adding it to the “On Page Enter” event:

The “Custom Code” block sits in the “Advanced” section of the Codeless toolbar:

The code inside of that block (accessible by clicking the “gear” icon) is:

Here’s the text version of that code:

inputComponent.el.setAttribute( "maxlength", 5 )

The code sets the max length to 5, but you can set it to whatever you want.

Make sure to declare the inputComponent argument in the Custom Code block.

Hope this helps.


Thank you for your response.
If there is any problem, I’ll ask again.

Hi, Mark.
how to set max value in input type number?

It is almost literally the same approach as shown earlier, but with a different property name"