Posted by: s4salman Jun 18 2020, 04:34 AM
Hi,
I am using this code, what i want is to random fill up stepa field with either option a or option b every time i refresh the page, any help is highly appreciated!:
CODE
<form action="myc.php" method="get">
<label for="element_1"> </label>
<div>
<select class="element select medium" name="stepa">
<option value="" selected="selected"></option>
<option value="option a" >Advanced Human option a</option>
<option value="option b">Advanced Human Option b</option>
</select>
</div>
<br>
<input type="submit">
</form>
Posted by: Christian J Jun 18 2020, 06:09 AM
Are you generating the HTML with PHP, or do you want to use javascript for the randomization?
Posted by: Christian J Jun 19 2020, 06:02 AM
I still don't understand, do want the dropdown to randomly look either like this:
CODE
<select class="element select medium" name="stepa">
<option value="" selected="selected"></option>
<option value="option a">Advanced Human option a</option>
</select>
or like this:
CODE
<select class="element select medium" name="stepa">
option value="" selected="selected"></option>
<option value="option b">Advanced Human Option b</option>
</select>
?
If so, what's the point of the first empty OPTION element? Also, why use a dropdown in the first place if there's only one selectable OPTION inside it (A or B)?
Posted by: pandy Jun 19 2020, 08:53 AM
Maybe alternating options should be selected?