# Dynamic field input validation

**URL:** <https://community.weweb.io/t/dynamic-field-input-validation/2482>\
**Category:** Ask us anything\
**Created:** [April 26, 2023, 5:02pm UTC](https://community.weweb.io/t/dynamic-field-input-validation/2482 "2023-04-26T17:02:10Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dorian](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/dorian/32/13183_2.png) [@Dorian](https://community.weweb.io/u/Dorian)\
**Post date:** [April 26, 2023, 5:02pm UTC](https://community.weweb.io/t/dynamic-field-input-validation/2482/1 "2023-04-26T17:02:10Z")

</div>

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!

> <https://twitter.com/ccgirl/status/1620940647254433792?ref_src=twsrc%5Etfw%7Ctwcamp%5Etweetembed%7Ctwterm%5E1620940647254433792%7Ctwgr%5E1e0cdb8ba5a9769e16e37fee7b28d5eebb9c5fea%7Ctwcon%5Es1_c10&ref_url=https%3A%2F%2Fpublish.twitter.com%2F%3Fquery%3Dhttps3A2F2Ftwitter.com2Fccgirl2Fstatus2F1620940647254433792widget%3DTweet>

---

<div class="post-metadata">

**Author:** ![gbeaudoin](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/gbeaudoin/32/3221_2.png) [@gbeaudoin](https://community.weweb.io/u/gbeaudoin)\
**Post date:** [April 26, 2023, 7:40pm UTC](https://community.weweb.io/t/dynamic-field-input-validation/2482/2 "2023-04-26T19:40:19Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Dorian](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/dorian/32/13183_2.png) [@Dorian](https://community.weweb.io/u/Dorian)\
**Post date:** [April 26, 2023, 8:22pm UTC](https://community.weweb.io/t/dynamic-field-input-validation/2482/3 "2023-04-26T20:22:24Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![gbeaudoin](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/gbeaudoin/32/3221_2.png) [@gbeaudoin](https://community.weweb.io/u/gbeaudoin)\
**Post date:** [April 26, 2023, 9:23pm UTC](https://community.weweb.io/t/dynamic-field-input-validation/2482/4 "2023-04-26T21:23:52Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Dorian](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/dorian/32/13183_2.png) [@Dorian](https://community.weweb.io/u/Dorian)\
**Post date:** [April 26, 2023, 10:49pm UTC](https://community.weweb.io/t/dynamic-field-input-validation/2482/5 "2023-04-26T22:49:28Z")

</div>

Tried and failed 🤣

If anyone can help I’d appreciate it!

---

<div class="post-metadata">

**Author:** ![Dorian](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/dorian/32/13183_2.png) [@Dorian](https://community.weweb.io/u/Dorian)\
**Post date:** [April 26, 2023, 11:35pm UTC](https://community.weweb.io/t/dynamic-field-input-validation/2482/6 "2023-04-26T23:35:31Z")

</div>

@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. 😃

---

<div class="post-metadata">

**Author:** ![raydeck](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/raydeck/32/384_2.png) [@raydeck](https://community.weweb.io/u/raydeck)\
**Post date:** [April 27, 2023, 1:33am UTC](https://community.weweb.io/t/dynamic-field-input-validation/2482/7 "2023-04-27T01:33:04Z")

</div>

Maybe this helps a bit with implementing regex for your use case? [Easy validation with regular expressions in weweb - Descript](https://share.descript.com/view/gI4BnLpRUgU)

---

<div class="post-metadata">

**Author:** ![Dorian](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/dorian/32/13183_2.png) [@Dorian](https://community.weweb.io/u/Dorian)\
**Post date:** [April 27, 2023, 1:41am UTC](https://community.weweb.io/t/dynamic-field-input-validation/2482/8 "2023-04-27T01:41:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Quentin](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/quentin/32/6_2.png) [@Quentin](https://community.weweb.io/u/Quentin)\
**Post date:** [April 27, 2023, 8:37am UTC](https://community.weweb.io/t/dynamic-field-input-validation/2482/9 "2023-04-27T08:37:03Z")

</div>

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 😉

---

<div class="post-metadata">

**Author:** ![Dorian](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/dorian/32/13183_2.png) [@Dorian](https://community.weweb.io/u/Dorian)\
**Post date:** [April 27, 2023, 3:54pm UTC](https://community.weweb.io/t/dynamic-field-input-validation/2482/10 "2023-04-27T15:54:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Dorian](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/dorian/32/13183_2.png) [@Dorian](https://community.weweb.io/u/Dorian)\
**Post date:** [April 27, 2023, 8:04pm UTC](https://community.weweb.io/t/dynamic-field-input-validation/2482/11 "2023-04-27T20:04:11Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![raelyn](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/raelyn/32/2803_2.png) [@raelyn](https://community.weweb.io/u/raelyn)\
**Post date:** [July 21, 2023, 2:53am UTC](https://community.weweb.io/t/dynamic-field-input-validation/2482/12 "2023-07-21T02:53:00Z")

</div>

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

Trying to do something similar with my passwords 🙂

---

<div class="post-metadata">

**Author:** ![Dorian](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/dorian/32/13183_2.png) [@Dorian](https://community.weweb.io/u/Dorian)\
**Post date:** [July 21, 2023, 10:28pm UTC](https://community.weweb.io/t/dynamic-field-input-validation/2482/13 "2023-07-21T22:28:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![raelyn](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/raelyn/32/2803_2.png) [@raelyn](https://community.weweb.io/u/raelyn)\
**Post date:** [July 22, 2023, 2:36pm UTC](https://community.weweb.io/t/dynamic-field-input-validation/2482/14 "2023-07-22T14:36:09Z")

</div>

Thank you 😊

---

<div class="post-metadata">

**Author:** ![vivien](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/vivien/32/11258_2.png) [@vivien](https://community.weweb.io/u/vivien)\
**Post date:** [October 18, 2024, 10:58am UTC](https://community.weweb.io/t/dynamic-field-input-validation/2482/15 "2024-10-18T10:58:32Z")

</div>

Hello Dorian, the video is down again. I’m trying to replicate exactly that right now. It would be of a great help 🙏

---

<div class="post-metadata">

**Author:** ![Dorian](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/dorian/32/13183_2.png) [@Dorian](https://community.weweb.io/u/Dorian)\
**Post date:** [October 18, 2024, 10:40pm UTC](https://community.weweb.io/t/dynamic-field-input-validation/2482/16 "2024-10-18T22:40:19Z")

</div>

Sorry it was a Loom and I must’ve deleted it to make way for newer videos!
