Please help me with CatPhotoApp Step 48

Step 48

If you select the Indoor radio button and submit the form, the form data for the button is based on its name and value attributes. Since your radio buttons do not have a value attribute, the form data will include indoor-outdoor=on, which is not useful when you have multiple buttons.

Add a value attribute to both radio buttons. For convenience, set the button’s value attribute to the same value as its id attribute.

      <label><input value="indoor" id="indoor" type="radio" name="indoor-outdoor"> Indoor</label>
      <label><input value="outdoor" id="outdoor" type="radio" name="indoor-outdoor"> Outdoor</label>

I wrote the right code, but I’m confused about the value attribute. Why do I need to add a value attribute here? What does it do? Why doesn’t the input element of type text in Step 40 need to have a value attribute?

Thank you!

1 Like

Thanks. I know what to do but I want to know why :cry:

1 Like

Without the value attribute, this is what will be submitted, indoor-outdoor = “on” if a box was checked, but remember you want to know if the user checked indoor or outdoor, so that’s not very useful. With the value attribute added this is what will be submitted indoor-outdoor = “indoor” if the user selected indoor, this way you now know what was selected .

1 Like

Thank you so much!!!

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.