HTML HTML Forms Choosing Options Checkboxes

guram dgebuadze
guram dgebuadze
Front End Web Development Techdegree Student 4,121 Points

Value when we have button. name.

As I get value is not necessery in general, but is it necessery to use value while we have buttons like type: radio and there can be different values like in the video? Must we use name?

2 Answers

Steven Parker
Steven Parker
155,987 Points

The "value" can be used to set the initial condition of the input, but it is not necessary if you want it to start at the default condition.

On the other hand "name" is important on a form input control because that's how the server will identify the input when the form is submitted.

guram dgebuadze
guram dgebuadze
Front End Web Development Techdegree Student 4,121 Points

thanks, but for example if there is for example category size this is written by name='size', but then if there are small, medium, big - how can be these three defined? in this case isn't the value necessary?

Steven Parker
Steven Parker
155,987 Points

Sure, if you supply answers to choose from instead of having the user type, then those would indeed be "value" attributes.