# HTML boolean attributes

**URL:** <https://swi-prolog.discourse.group/t/html-boolean-attributes/2888>\
**Category:** General\
**Tags:** http\
**Created:** [September 7, 2020, 8:14pm UTC](https://swi-prolog.discourse.group/t/html-boolean-attributes/2888 "2020-09-07T20:14:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alex](https://avatars.discourse-cdn.com/v4/letter/a/db5fbb/32.png) [@Alex](https://swi-prolog.discourse.group/u/Alex)\
**Post date:** [September 7, 2020, 8:14pm UTC](https://swi-prolog.discourse.group/t/html-boolean-attributes/2888/1 "2020-09-07T20:14:31Z")

</div>

Hi,  
How can I set the boolean attribute “required” for use with html//1?

```html
<input class='form-control'
           id='code'
           type='number'
           required>

```

---

<div class="post-metadata">

**Author:** ![CapelliC](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/capellic/32/17_2.png) [@CapelliC](https://swi-prolog.discourse.group/u/CapelliC)\
**Post date:** [September 8, 2020, 5:34am UTC](https://swi-prolog.discourse.group/t/html-boolean-attributes/2888/2 "2020-09-08T05:34:34Z")

</div>

Syntactically it’s a as simple as it could be, I think. Just

```prolog
...
div(['with a check', input([type=checkbox,checked])]),
...

```

produces a checked check box.

Semantically, it’s another story. Reacting to ‘required’ means different actions in different parts of code. Are you going to handle it client side or server side ? What your ‘theme’ says ? Mostly depends on this.

---

<div class="post-metadata">

**Author:** ![Alex](https://avatars.discourse-cdn.com/v4/letter/a/db5fbb/32.png) [@Alex](https://swi-prolog.discourse.group/u/Alex)\
**Post date:** [September 9, 2020, 2:13pm UTC](https://swi-prolog.discourse.group/t/html-boolean-attributes/2888/3 "2020-09-09T14:13:24Z")

</div>

Hi Carlo,  
Thanks for your reply.
