How to make hidden field not required? $form['questionfield_form_fieldset'][$i]['answer_type'] = [
        '#type' =&gt; 'radios',
        '#title' =&gt; $this-&gt;t('Select Answer Type'),
        '#options' =&gt; array(
          'select' =&gt;t('Drop Down'),
          'radios' =&gt;t('Radio'),
          'rating' =&gt;t('Rating'),
        ),
        '#description' =&gt; $this-&gt;t('Select the way answer will disply eg. in radio button or in selectbox(Dropdown)'),
        '#default_value' =&gt; $config-&gt;get($form_count . '.' . $drupal_form_id . '.' . 'answer_type'),
        '#required' =&gt; TRUE,
      ];



      $form['questionfield_form_fieldset'][$i]['answer_box_id'] = [
        '#type' =&gt; 'textarea',
        '#title' =&gt; $this-&gt;t('Answer for above question'),
        '#description' =&gt; $this-&gt;t('Add your answers for above question here.'),
        '#default_value' =&gt; $config-&gt;get($form_count . '.' . $drupal_form_id . '.' . 'answer_box_id'),
        '#required' =&gt; TRUE,
        '#states' =&gt; array(
      'visible' =&gt; array(
        array(
        array(":input[name='questionfield_form_fieldset[$i][answer_type]']" =&gt; array('value' =&gt; 'select')),
        'or',
        array(":input[name='questionfield_form_fieldset[$i][answer_type]']" =&gt; array('value' =&gt; 'radios')),
      ),
        ),
    ),
      ];


I want to make answer_box_id as not required when user click rating radio button .
You need to remove '#required' =&gt; TRUE from the render array.

States only control "soft" changes through javascript. They don't (and can't) have any effect on the backend validation; if they could, it would be trivial for anybody to bypass the server-side validation for a field just by setting some CSS styles on it. That would not be a good situation to get into.