# Unique field validation on Form Node

**URL:** <https://discourse.nodered.org/t/unique-field-validation-on-form-node/40844>\
**Category:** Dashboard\
**Created:** [12 February 2021 00:34 UTC](https://discourse.nodered.org/t/unique-field-validation-on-form-node/40844 "2021-02-12T00:34:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mickos](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mickos/32/68672_2.png) [@mickos](https://discourse.nodered.org/u/mickos)\
**Post date:** [12 February 2021 00:34 UTC](https://discourse.nodered.org/t/unique-field-validation-on-form-node/40844/1 "2021-02-12T00:34:09Z")

</div>

Hello,

I am using a Dashboard form node with 4 elements that I pass into an SQL statement through a function node.

All is working fine but, i would like to only allow the user to input data into a single field for each search request. For example, if more than one field is filled out, throw an error of some sort that too many values were input.

There are probably many ways to do this, I coudn't find any that were like what i am trying to acheive though.

These are my payload objects:  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/c/3ce44d9bd0ee3a60deee7a8b1ea206fad70e9df4.png)

This is my form setup:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/1/e/1e1347db2f16f7f5ea68bf363a4be852b594bcc9.png)

Hope this makes sense

Thanks  
Mick

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [12 February 2021 08:55 UTC](https://discourse.nodered.org/t/unique-field-validation-on-form-node/40844/2 "2021-02-12T08:55:34Z")

</div>

You can use the Notification node to popup a message to tell the user of his error. Alternatively you could disable other fields once one has been filled in, though I am not sure if you can do that in a form, so it might be necessary to use individual fields in that case.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [12 February 2021 09:15 UTC](https://discourse.nodered.org/t/unique-field-validation-on-form-node/40844/3 "2021-02-12T09:15:21Z")

</div>

Yes - I would build a form using separate elements instead - then you can use msg.enabled=false to disable the others as required.

---

<div class="post-metadata">

**Author:** ![mickos](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mickos/32/68672_2.png) [@mickos](https://discourse.nodered.org/u/mickos)\
**Post date:** [13 February 2021 03:43 UTC](https://discourse.nodered.org/t/unique-field-validation-on-form-node/40844/4 "2021-02-13T03:43:41Z")

</div>

Yeah ok, i was thinking of counting the number of payloads with a length \>0 and if the count was \>1, throw a notification to the dash. Not sure if that could work or not.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [15 March 2021 03:43 UTC](https://discourse.nodered.org/t/unique-field-validation-on-form-node/40844/5 "2021-03-15T03:43:50Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
