Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML HTML Forms Choosing Options Checkboxes

guram dgebuadze
seal-mask
.a{fill-rule:evenodd;}techdegree
guram dgebuadze
Front End Web Development Techdegree Student 4,122 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
231,248 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
seal-mask
.a{fill-rule:evenodd;}techdegree
guram dgebuadze
Front End Web Development Techdegree Student 4,122 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
231,248 Points

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