Questions tagged [required]

Required is an HTML attribute of an input element that forces that the input be supplied.

Required fields are a common form of front-end validation to prevent users from submitting data that is logically incomplete. Though making fields required may not be an end-all validation technique, it is sufficient in a large number of cases.

897 questions
577
votes
5 answers

How to use the "required" attribute with a "radio" input field

I am just wondering how to use the new HTML5 input attribute "required" in the right way on radio buttons. Does every radio button field need the attribute like below or is it sufficient if only one field gets it?
nerdess
  • 10,051
  • 10
  • 45
  • 55
91
votes
4 answers

Required and Optional Arguments Using Boost Library Program Options

I'm using Boost Program Options Library to parse the command line arguments. I have the following requirements: Once "help" is provided, all the other options are optional; Once "help" is not provided, all the other options are required. How I can…
Peter Lee
  • 12,931
  • 11
  • 73
  • 100
79
votes
7 answers

Explain why constructor inject is better than other options

In a Pro Spring 3 Book, Chapter 4 - Introduction IOC and DI in Spring - Page 59, In "Setter Injection vs. Constructor Injection" section, a paragraph says Spring included, provide a mechanism for ensuring that all dependencies are defined when …
minil
  • 6,895
  • 16
  • 48
  • 55
67
votes
7 answers

Is the 'as' keyword required in Oracle to define an alias?

Is the 'AS' keyword required in Oracle to define an alias name for a column in a SELECT statement? I noticed that SELECT column_name AS "alias" is the same as SELECT column_name "alias" I am wondering what the consequences are of defining a…
Jonathan
  • 10,936
  • 8
  • 64
  • 79
56
votes
5 answers

Django: Make certain fields in a ModelForm required=False

How do I make certain fields in a ModelForm required=False? If I have: class ThatForm(ModelForm): class Meta: widgets = {"text": Textarea(required=False)} Or if I have: class ThatForm(ModelForm): text = Textarea(required=False) Django…
Synthead
  • 2,162
  • 5
  • 22
  • 25
45
votes
5 answers

Angular is automatically adding 'ng-invalid' class on 'required' fields

I am building an angular app for which I have some forms set up. I have some fields that are required to be filled before submission. Therefore I have added 'required' on them:
Spearfisher
  • 8,445
  • 19
  • 70
  • 124
37
votes
2 answers

When to use the required attribute vs the aria-required attribute for input elements?

I'm trying to make a form accessible. Should I make my inputs have both required and aria-required attributes, or just one? Or like this?
Ralph David Abernathy
  • 5,230
  • 11
  • 51
  • 78
37
votes
4 answers

Enforce not-null field in JSON object

Our REST API receives some JSON objects input where some fields are required to be not null. Those can be either String/Integer or even might be some other class instance as reference. We are trying to find a way to enforce those field to be not…
urir
  • 1,960
  • 3
  • 23
  • 40
33
votes
6 answers

I want to use named parameters in Dart for clarity. How should I handle them?

TL;DR: Named parameters are optional as a result of a conscious design choice. Short of having official language support, is there any way to enforce (and inform) required named arguments? I find it extremely useful to use named parameters when…
Kafeaulait
  • 664
  • 1
  • 6
  • 14
33
votes
7 answers

textarea's "required" attribute doesn't work even though the value is empty

I created a simple page with list box and text area with conditions that all should be required. List box are working fine, but textarea box doesn't tell that the field is required to be filled. Ratings &…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/html" class="post-tag grid--cell" title="show questions tagged 'html'" rel="tag">html</a> <a href="../../questions/tagged/textarea" class="post-tag grid--cell" title="show questions tagged 'textarea'" rel="tag">textarea</a> <a href="../../questions/tagged/required" class="post-tag grid--cell" title="show questions tagged 'required'" rel="tag">required</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked Jun 12 '13 at 08:56">asked Jun 12 '13 at 08:56</time> <a href="../../users/2264834/divakar-scm" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/2264834.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="divakar.scm" /> </a> <div class="s-user-card--info"> <a href="../../users/2264834/divakar-scm" class="s-user-card--link">divakar.scm</a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">1,256</li> <li class="s-award-bling s-award-bling__gold" title="5 gold badges">5</li> <li class="s-award-bling s-award-bling__silver" title="21 silver badges">21</li> <li class="s-award-bling s-award-bling__bronze" title="32 bronze badges">32</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="mln24"> <div class="question-summary" id="question-summary-67642000"> <div class="statscontainer"> <div class="stats"> <div class="vote"> <div class="votes"> <span class="vote-count-post"><strong>31</strong></span> <div class="viewcount">votes</div> </div> </div> <div class="status answered-accepted"> <strong>2</strong> answers </div> </div> </div> <div class="summary"> <h3><a href="../../questions/67642000/what-is-the-difference-between-required-and-required-in-flutter-what-is-the-di" class="question-hyperlink">what is the difference between required and @required in flutter. What is the difference between them and when do we need to use them?</a></h3> <div class="excerpt">If I delete required from the named parameters, it gives me an error: The parameter 'color' // can't have a value of 'null' because of its type, but the implicit default value is 'null'. What is the difference between them and when do we need to…</div> <div class="grid ai-start jc-space-between fw-wrap"> <div class="grid gs4 fw-wrap tags "> <a href="../../questions/tagged/flutter" class="post-tag grid--cell" title="show questions tagged 'flutter'" rel="tag">flutter</a> <a href="../../questions/tagged/dart" class="post-tag grid--cell" title="show questions tagged 'dart'" rel="tag">dart</a> <a href="../../questions/tagged/required" class="post-tag grid--cell" title="show questions tagged 'required'" rel="tag">required</a> <a href="../../questions/tagged/named-parameters" class="post-tag grid--cell" title="show questions tagged 'named-parameters'" rel="tag">named-parameters</a> </div> <div class="started mt0"> <div class="s-user-card s-user-card"> <time class="s-user-card--time" datetime="asked May 21 '21 at 18:10">asked May 21 '21 at 18:10</time> <a href="../../users/7777926/ulukbek" class="s-avatar s-avatar__32 s-user-card--avatar"> <img class="s-avatar--image" src="../../users/profiles/7777926.webp" data-jdenticon-width="32" data-jdenticon-height="32" data-jdenticon-value="ulukbek " /> </a> <div class="s-user-card--info"> <a href="../../users/7777926/ulukbek" class="s-user-card--link">ulukbek </a> <ul class="s-user-card--awards"> <li class="s-user-card--rep" title="reputation score">483</li> <li class="s-award-bling s-award-bling__silver" title="4 silver badges">4</li> <li class="s-award-bling s-award-bling__bronze" title="10 bronze badges">10</li> </ul> </div> </div> </div> </div> </div> </div> </div> <div class="s-pagination pager fr"> <div class="s-pagination--item is-selected">1</div> <a class="s-pagination--item" href="../../questions/tagged/required_page=2" rel="" title="Go to page 2">2</a> <a class="s-pagination--item" href="../../questions/tagged/required_page=3" rel="" title="Go to page 3">3</a> <div class="s-pagination--item s-pagination--item__clear">…</div> <a class="s-pagination--item" href="../../questions/tagged/required_page=59" rel="" title="Go to page 59">59</a> <a class="s-pagination--item" href="../../questions/tagged/required_page=60" rel="" title="Go to page 60">60</a> <a class="s-pagination--item" href="../../questions/tagged/required_page=2" rel="next" title="Go to page 2"> Next</a> </div> </div> </div> </div> </div> <script src="../../static/js/stack-icons.js"></script> <script src="../../static/js/fromnow.js"></script> </body> </html>