Community forum for knowledge and support

Updated 6 months ago

Setting a Minimum Value for a Number Field in a Multi-step Form

At a glance

Hi all, this is my first time asking for help and I would appreciate any assistance 🙂

I have a small question about using the multi-step form. We’re currently using Formly scripts to build it, and I was wondering if anyone knows how to set a minimum value for an input ‘number’ field. For example, one of our inputs needs a minimum validation value of 20,000, so the next button stays disabled until the correct value is entered.

Minimum character could be an alternative solution, but the problem is that we can only set a minimum pricing of 10,000 or 100,000 due to character limits, while the requirement is exactly 20,000.

It seems that the Formly script overrides any custom code we add, allowing the next button to be clickable even if the value does not meet the minimum requirement. If anyone has had a similar experience or knows how to solve this, your help would be much appreciated. Cheers!

M
V
2 comments

I believe the only way you'll be able to achieve this is to use ChatGPT to write some custom JS.

But you said that the Formly script overrides any custom code you add?

Let's page in the Founder of Formly!

how can we add custom JS field validation to a formly multi-step form?

Hey , custom validation may not work as it may conflict with formly's validation code.

You could use custom js to validate this and "show" a custom next button which when you click can psuedo click a hidden next button.

That should work I believe 🙂

Add a reply
Sign up and join the conversation on Slack