Help needed for $1.00. I have a form, and the user can sel…

Twetch ·

Help needed for $1.00.

I have a form, and the user can select "poor", "fair" or "good". However, I would like that a default value is assigned, and it is "good". If this does not suite the user they will be able to select and alter the choice.

Anyone?

Replies

Twetch ·

<option selected>

Twetch ·

How do I define that the selected option will be "good" in the above code example?

I have seen online that I can say value="good" and selected="selected" but that doesn't quite work.

Exactly how would it be written in the above example?

Twetch ·

<option selected value="good">

Twetch ·

Okay I’ll give it a go.

That should fit well with the code snippet which is attached above?

Because the values which are displayed (poor, fair, & good) aren’t directly visible in the code but liked from somewhere else.

Anyway, will try it out! 👍

Twetch ·

Should look something like this

<select value="rating">
<option value="poor">Poor</option>
<option value="fair">Fair</option>
<option selected value="good">Good</option>
</select>

Twetch ·

Will pop it in in the morning. 👌🤞