The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Random Fill Form Drop Down, Random Fill Form Drop Down
s4salman
post Jun 18 2020, 04:34 AM
Post #1





Group: Members
Posts: 2
Joined: 18-June 20
Member No.: 27,406



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>
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Jun 18 2020, 06:09 AM
Post #2


.
********

Group: WDG Moderators
Posts: 8,622
Joined: 10-August 06
Member No.: 7



Are you generating the HTML with PHP, or do you want to use javascript for the randomization?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
s4salman
post Jun 19 2020, 12:54 AM
Post #3





Group: Members
Posts: 2
Joined: 18-June 20
Member No.: 27,406



i want javascript
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Jun 19 2020, 06:02 AM
Post #4


.
********

Group: WDG Moderators
Posts: 8,622
Joined: 10-August 06
Member No.: 7



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)? unsure.gif
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Jun 19 2020, 08:53 AM
Post #5


Computer says no.
********

Group: WDG Moderators
Posts: 19,234
Joined: 9-August 06
Member No.: 6



Maybe alternating options should be selected? unsure.gif
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 25th November 2020 - 06:33 AM