I want to that my input field get only 8 symbol. How can i do this?

Hi everyone! I want to that my input field get only 8 symbol. How can i do this?


There is no direct way to limit input length, so what I would suggest instead is to use input validation techniques to either alert the user that the input is too long, or not allowing the user to continue (switch page, save, whatever is your case) before the input is less than 8 characters. Here’s some examples of input validation.

You could bind your input to a page variable, then receive the page variable changed event:
Set PAGE_Var = RIGHT_STRIP(pageVars.PAGE_Var, LENGTH(pageVars.PAGE_Var) - 8).

That should keep the input to 8 characters or less.

1 Like

Thank you! Where I should write this formula?
RIGHT_STRIP(pageVars.PAGE_Var, LENGTH(pageVars.PAGE_Var) - 8).

You put a set Page Variable flow function in the page var changed event. And just set the page variable = that formula

I hope that works. My only concern is that would change the page variable inside of its change event which might cause the event to fire again on itself. Im not sure if that will get handled correctly. Give it a try and see!

Sorry, but there I can’t bind ‘set page variable’ to ‘formula’.

Also I tried to bind it to ‘Assigned value’ and for ‘input value’.
It’s not working…

Any other ideas to solve it?
Could anyone help?

That is odd. The Assigned Value should be Bind to Formula. Mine allows me to bind to formula:

Youre in the wrong area to Receive Event. You need to be in the Page Layout area, not the Input Field Phone Number component.

I set as you wrote, thank you anyway!

Could you suggest other ways, please? :pleading_face: :pray:

The closest I could get to is to set a Receive event flow function, set it to page variable your_text changed, add an IF flow function to check if LENGTH(your_text) > 8, and if that evaluates as true then use TRUNCATE(your_text, 8, "") to set the length back to 8. This results in a small hackiness in the UI when the user goes over 8 characters, but gets the job done :slight_smile:

1 Like

Thank you very much!!! :smiling_face_with_three_hearts: :smiling_face_with_three_hearts: :smiling_face_with_three_hearts:

Thank you for this, Cecilia! This is far better alternative than our previous (somewhat convoluted) method of binding a button to a Boolean variable alongside an input field’s character counter where, if the counter’s max value is exceeded, the button would be replaced by a text component/inactive button stating “too long” or something similar.

The only potential issue is that this function would appear to sometimes delete the entire last word typed in its attempt to truncate rather than the last character. I thought it was glitching out at first while copy-pasting “Lorem ipsum” sample text in while testing. This is a bit concerning as it would greatly confuse and annoy users trying to enter in profile information such as a long name where they’ll wonder why the whole last word they typed keeps getting deleted as they hit the character limit. Any suggestions, maybe?

Nonetheless, until Appgyver supports native max-length settings, this will more than suffice in many areas.

Thanks again! :slight_smile:

1 Like

Well, what do you know? Once again, blending two separate suggestions together ends up working better than either one individually! :smiley:

So I used a bit of @Cecilia and @JOHN_WORSHAM’s examples and created a perfect max-length just now. I’m replying to you @A_VA_Help just in case you might want to try it yourself for better results – or for anyone else who stumbles upon this thread.

Start with creating that page variable for your input. Next we’ll go to the Page Layout logic flow in the tree. Here are the screenshots of the flow and each respective formula function for you to replicate. Do replace each “pageVars.pUser_askBox_characterCounter” you see in the images with your own page variable names!

The logic flow:

Cecelia’s If condition utility formula:

John’s right-strip formula for the page variable:

I believe, all John was missing was the If condition there. Thanks again, you two. :slight_smile:


Wow, thank you very much!!! :smiling_face_with_three_hearts: :smiling_face_with_three_hearts:

1 Like

for me its dont work