# How to declare that an HTML input is required

**URL:** <https://discourse.nodered.org/t/how-to-declare-that-an-html-input-is-required/7096>\
**Category:** General\
**Created:** [21 January 2019 12:37 UTC](https://discourse.nodered.org/t/how-to-declare-that-an-html-input-is-required/7096 "2019-01-21T12:37:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lionel](https://avatars.discourse-cdn.com/v4/letter/l/f9ae1b/32.png) [@Lionel](https://discourse.nodered.org/u/Lionel)\
**Post date:** [21 January 2019 12:37 UTC](https://discourse.nodered.org/t/how-to-declare-that-an-html-input-is-required/7096/1 "2019-01-21T12:37:02Z")

</div>

Hi,  
I want to declare an input (which is part of an EditableList) as required  
I have tried that

```auto
$( "<input/>", { class: "node-input-text-value-en" ,
                 type : "text",
                 style: "margin-left: 15px; width: 70%;",
                 required
               }
  )

```

But it doesn't work ... can you help ? Thx

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [21 January 2019 12:45 UTC](https://discourse.nodered.org/t/how-to-declare-that-an-html-input-is-required/7096/2 "2019-01-21T12:45:36Z")

</div>

Hi @Lionel - when sharing code, please use ``` around your code rather than blockquoting which doesn't do anything to maintain the code formatting.

"required" is not a flag you set on the html input element - you set it against the properties listed in the node's defaults object. [https://nodered.org/docs/creating-nodes/properties](https://nodered.org/docs/creating-nodes/properties)

---

<div class="post-metadata">

**Author:** ![Lionel](https://avatars.discourse-cdn.com/v4/letter/l/f9ae1b/32.png) [@Lionel](https://discourse.nodered.org/u/Lionel)\
**Post date:** [21 January 2019 12:55 UTC](https://discourse.nodered.org/t/how-to-declare-that-an-html-input-is-required/7096/3 "2019-01-21T12:55:23Z")

</div>

BUT, the concerned input element is part of an EditableList, so it is not declared in the default objects, only the EditableList is declared in defaults

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [21 January 2019 13:27 UTC](https://discourse.nodered.org/t/how-to-declare-that-an-html-input-is-required/7096/4 "2019-01-21T13:27:13Z")

</div>

In which case you'll have to build in your own logic to check if the field has a valid value or not. There's no built-in way of doing that.

---

<div class="post-metadata">

**Author:** ![Lionel](https://avatars.discourse-cdn.com/v4/letter/l/f9ae1b/32.png) [@Lionel](https://discourse.nodered.org/u/Lionel)\
**Post date:** [21 January 2019 13:51 UTC](https://discourse.nodered.org/t/how-to-declare-that-an-html-input-is-required/7096/5 "2019-01-21T13:51:39Z")

</div>

I have added a "border" property in the input style, in case of bad entry

```auto
style: "margin-left: 15px; width: 70%; border: solid 1px #FF0000;"

```

And it seems, it is not supported, there is no effect.  
Can you tell me where I can find the supported HTML options for the input ?
