Dynamic field input validation

Hi everyone, Happy Wednesday!

I stumbled across this awesome implementation that @Joyce referenced in an earlier thread somewhere. Can anyone provide more details on how to go about implementing this please? The poster on twitter refers to using WeWeb “states”. Thanks!

You could create a Javascript function that validates the input using a regex, and returns a bool value depending on whether the content matches the regex or not. Then, you use this return value to hide/show elements, change color, etc.

Thanks @gbeaudoin I’ll give it a try. Assuming I wanted to implement what is shown in the video, I would need 3 functions each with their own boolean output, right?

Yes that’s correct. Or at least 3 different regex (which could be in the same function or not).

That can be tied to states, or to components directly.

1 Like

Tried and failed :rofl:

If anyone can help I’d appreciate it!

@carri Are you the Carri from the twitter post? If you are, I’d really appreciate your help with this! What you implemented looks fantastic. :smiley:

Maybe this helps a bit with implementing regex for your use case? Easy validation with regular expressions in weweb - Descript

4 Likes

Once again you are a lifesaver @raydeck thank you! Its super simple when you know how…! :wink:

Hey @Dorian, do you have access to WeWeb Copilot?

I was thinking this might help for your use-case, as you could have asked WeWeb copilot to write this regex/function using a prompt :wink:

2 Likes

Hey @Quentin, no I don’t, but I just submitted a request to sign up. That would be awesome, thank you!

To close the loop, here is what I was able to implement. Fantastic stuff! WeWeb is an amazing platform. Thanks again @raydeck for your help.

5 Likes

Hey Dorian do you still have that video? Can’t seem to view it anymore. :frowning:

Trying to do something similar with my passwords :slight_smile:

@raelyn No, so I recorded a new one for you. :slightly_smiling_face:

1 Like

Thank you :blush:

1 Like