Questions tagged [required-field]
Indicates the required status of data field, where "required" is contrasted from "optional". Such status generally indicates that any [non-null] value is considered acceptable when populating or evaluating a specific field or fields.
required-field
137
questions
1
vote
2
answers
89
views
Can I suppress rule CS9035 once?
I have an Options class like this (note the required keyword):
public class Options
{
[Required]
public required string Endpoint { get; set; }
}
It is loaded from the configuration like this:
...
0
votes
1
answer
242
views
Pydantic to JSON Schema translation: How to write a field with no default value that is not required in the JSON schema?
I am using Pydantic 2.6.4 to generate JSON schemas for web forms, using React as the front-end framework. How do I write a field in a Pydantic model that has no default value but is not included in ...
0
votes
3
answers
645
views
C# 11 required member false positive
The code below can not compile and reports a CS9035 error. Required member 'A.FieldA' must be set in the object initializer or attribute constructor.
This seems like a false positive. The required ...
0
votes
0
answers
137
views
React-hook-form doesn't recognize input value
My react-hook-form doesn't recognize the input value once the user fills the input box.
It keeps returning the 'This field is required' error message with the password field.
Here's my code.
function ...
0
votes
1
answer
121
views
Is it possible to add a custom validation message to my required field?
I have an EditForm with some InputText. Some of the textboxes are required and as such in their class are declared using the [Required]. However some of them also have a [StringLength(100, ...
0
votes
1
answer
246
views
how I create a form input text readonly and required at the same time?
I'm reviewing my code wrote time ago. The input text that I wrote is the following:
<input type="text" class="form-control form-control-sm" id="mypid" name="mypid&...
0
votes
0
answers
60
views
How to make a required field Disable on a certain view?
In my ASP.NET Core application, I have a BassModel class.
In it, I have a field that is marked as required:
[Required(ErrorMessage = "Required field")]
public string InputText { get; set; }
...
2
votes
3
answers
2k
views
Is there a way to make an inherited abstract property a required constructor argument in a Python dataclass?
I'm using Python dataclasses with inheritance and I would like to make an inherited abstract property into a required constructor argument. Using an inherited abstract property as a optional ...
0
votes
1
answer
595
views
HTML Form either of two options need to be filled completely
So I've been stuck on this part of my HTML form.
Either the dropdown "A" needs to be selected or ALL options by "B" need to be filled out. Either one of them is required, but I ...
1
vote
1
answer
980
views
Remove required in the field Contact Form 7
is it possible to remove this attribute or class from the field placed in the form?
I have some fields as required, but for a strange reason, it marks all the fields as required
<label>Name:
[...
0
votes
0
answers
39
views
Why is my browser preventing me from submitting empty fields ? Symfony
I made a form that allows users to register.
There is one question that asks what language they want to learn. In order to make the question optional I created the new field type to my User entity in ...
0
votes
0
answers
114
views
The bootstrap required error message is not visible outside the browser window
There is a form with a lot of input fields, so you have to scroll down to the bottom of the page for the save button to work. However, if I do not fill in a required field, it scrolls to the top of ...
1
vote
2
answers
117
views
Writing a function to calculate object properties whereas the object includes optional properties
I have a record of data (object-literal), and I need to calculate the average of several of its properties. For example, consider that each record reflects a sample of dog breeds and their weights. We ...
0
votes
1
answer
305
views
I want to add required attribute in MUI TextField based on a condition
I want to add required attribute in MUI TextField based on a condition.
Var flag = false
If (investment>50000 && investment<5000){
flag = true
}
<TextField
required = {flag}
id=&...
0
votes
1
answer
108
views
How Can I Avoid This Warning ' A component is changing an uncontrolled input to be controlled. This is likely caused by the value changing from...'?
const AddItem = () => {
const [user] = useAuthState(auth);
const navigate = useNavigate();
const handleAddCar = (e) => {
e.preventDefault();
const carObj = {
name: e.target....