# About the survey form project

**URL:** <https://forum.freecodecamp.org/t/about-the-survey-form-project/359044>\
**Category:** I Built This\
**Created:** [March 14, 2020, 11:46pm UTC](https://forum.freecodecamp.org/t/about-the-survey-form-project/359044 "2020-03-14T23:46:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![josh98](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@josh98](https://forum.freecodecamp.org/u/josh98)\
**Post date:** [March 14, 2020, 11:46pm UTC](https://forum.freecodecamp.org/t/about-the-survey-form-project/359044/1 "2020-03-14T23:46:05Z")

</div>

I’m about to finish the algorithm of my survey, but I have one flaw that I want to fix.  
If you see my survey, I asked “Have you ever used video chat before?” and put two radio buttons: ‘yes’ or ‘no’. I would like to make a required input for the rest of the questions if the user clicks yes, but if the case is opposite then optional. Is there any way that I can do that?

here is my pen: [https://codepen.io/josh98/pen/KKpoeOm?editors=1100](https://codepen.io/josh98/pen/KKpoeOm?editors=1100)

---

<div class="post-metadata">

**Author:** ![lasjorg](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/lasjorg/32/280761_2.png) [@lasjorg](https://forum.freecodecamp.org/u/lasjorg)\
**Post date:** [March 15, 2020, 4:36am UTC](https://forum.freecodecamp.org/t/about-the-survey-form-project/359044/2 "2020-03-15T04:36:07Z")

</div>

You would need to add some JavaScript for that. Disabling the other inputs (select/checkboxes), and/or requiring the select element, based on the radio buttons state isn’t too hard. But doing validation on the checkboxes can get a little more tricky because there isn’t a formal way of requiring the checking of a group of checkboxes. It can be done but you would likely have to set a custom validity message `setCustomValidity` to make the UX less confusing.

I can’t really post code right now, maybe later, or maybe someone else will post some code.

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [June 1, 2021, 1:39pm UTC](https://forum.freecodecamp.org/t/about-the-survey-form-project/359044/3 "2021-06-01T13:39:48Z")

</div>

Closed on June 1, 2021, 1:39pm UTC


