You are viewing limited content. For full access, please sign in.

Question

Question

Remove "required" attribute for multiline fields

asked on October 19, 2023 Show version history

Hi. I need to remove the required attribute for a multiline field. None of these javascript codes worked :(

1)

        $('_RecommendationNotes, input, select').each(function() {
          $(this).removeAttr('required');
        }); 

 

2) 

$('._RecommendationNotes').removeAttr('required', 'True');

 

3)

$('._RecommendationNotes input').removeAttr('required', 'True');

 

4)

$('._RecommendationNotes input').removeClass('required').removeAttr('required');

0 0

Answer

SELECTED ANSWER
replied on October 19, 2023

Almost everything uses input elements (single line, email, currency, checkbox, radio button, etc., etc.).  The exceptions are rich text (which is a whole other animal), drop-downs (which use select elements), and multi-line (which use textarea fields).

I have not tested it at this moment, but assuming that:
     $('._RecommendationNotes input').removeAttr('required', 'True');
worked on a single line field, then you should be able to make this:
     $('._RecommendationNotes textarea').removeAttr('required', 'True');
work on multi-line fields.

Good luck!

1 0

Replies

replied on October 19, 2023

It worked!!! Thanks a lot smiley

1 0
replied on February 8 Show version history

Drop-down:

Set required:

$('.requiredDropDown select').attr('required', 'True');

 

Not required:

$('.requiredDropDown select').removeClass('required').removeAttr('required');

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.