Dynamic value for form Validation

I need to use server connect data to set the value of max number it a text field validation. There is not a dynamic picker, just static value. Is it possible to do this?

Is this text field an input field, like in a form?

Yes, it’s a text input.

If it is a text input, with a type of text, you should be able to click on Validation down the bottom of the properties panel and select text and then maximum length.

This is the client side validation that would prevent the form from being submitted if its not valid. Is that what you were after?

Yes, but it only allows me to enter a static number (thought there would be a dynamic picker there). The number is dynamic based on the results of a ServerConnect on the page.
Screen Shot 2020-07-01 at 8.19.24 PM

Ok, I understand now.

I don’t know off hand if its possible. But someone else might know or i’ll look into it.

Its possible you could use dmx-bind to make the attribute dynamic.

1 Like

Thanks for you detailed answer though, appreciate your time!

Ok, so i think i got it for you.

If you add the validator that you want on the client side, i.e. maxlength, you can go into code view and add ‘dmx-bind:’ to that attribute. Like this:

image

In the " " marks just put the server connect value you want to limit the length to.

I think you will need to have that server connect component loaded in app connect, in my case i just used a variable i had lying around which had a 0 or 1 value, but i think any SC query/value should work.

Hope this helps.

1 Like

Worked like a charm, thanks Phillip!

No worries. Just happy to be able to pass the love back and help someone else on the forum instead of being the one needing help :slight_smile:

Glad it worked. First time using that trick myself but remember reading it in a forum a couple days ago.