Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8982165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T20:31:03+00:00 2026-06-15T20:31:03+00:00

I have a form and for testing I want to have a button to

  • 0

I have a form and for testing I want to have a button to automatically fill out all fields randomly in each group, for checkboxes and radios just select one randomly from each group type deal. Most of the forms are quite large and for testing purposes it’s getting to be a pain in the butt to select items all the time.

An example of the form is:

<div class="rows"><b>Education</b><br>
<select name="edu" id="edu" validate="required:true"><option value="">Select One</option>
<option value="Some High School">Some High School</option>
<option value="High School graduate">High School graduate</option>
<option value="Some college">Some college</option>
<option value="College graduate">College graduate</option>
<option value="Master’s degree">Master’s degree</option>
<option value="Doctorate">Doctorate</option>
</select></div>

<div class="rows"><b>Payor status</b><br>
<select name="payor" id="payor" validate="required:true"><option value="">Select One</option>
<option value="Medicare/Medicaid">Medicare/Medicaid</option>
<option value="Insurance">Insurance</option>
<option value="Self Pay">Self Pay</option>
</select></div><br>

<div class="rows"><b>I am a physician.</b><br>
<input type="hidden" name="type33-8" value="YN">
<label><input type="radio" name="33-8" id="33Y" value="Yes" validate="required:true"> Yes</label> 
<label><input type="radio" name="33-8" id="33N" value="No"> No</label><br>
<label for="33-8" class="error">Please select an option</label></div><b>This doctor:</b><br>
<input type="hidden" name="type34" value="6PMultiple">

<div class="rows"><label>1.     Appears sincere.</label><br>
<input type="hidden" name="type34-247" value="6PMultiple">
<label><input type="radio" name="34-247" id="341" value="1" validate="required:true" > 1 - Very Strongly Disagree</label> 
<label><input type="radio" name="34-247" id="342" value="2" > 2 -  Strongly Disagree</label> 
<label><input type="radio" name="34-247" id="343" value="3" > 3 -  Disagree</label> 
<label><input type="radio" name="34-247" id="344" value="4" > 4 -  Agree</label> 
<label><input type="radio" name="34-247" id="345" value="5" > 5 -  Strongly Agree</label> 
<label><input type="radio" name="34-247" id="346" value="6" > 6 -  Very Strongly Agree</label></div>

<div class="rows"><label>2.     Is professional.</label><br>
<input type="hidden" name="type34-248" value="6PMultiple">
<label><input type="radio" name="34-248" id="341" value="1" validate="required:true" > 1 - Very Strongly Disagree</label> 
<label><input type="radio" name="34-248" id="342" value="2" > 2 -  Strongly Disagree</label> 
<label><input type="radio" name="34-248" id="343" value="3" > 3 -  Disagree</label> 
<label><input type="radio" name="34-248" id="344" value="4" > 4 -  Agree</label> 
<label><input type="radio" name="34-248" id="345" value="5" > 5 -  Strongly Agree</label> 
<label><input type="radio" name="34-248" id="346" value="6" > 6 -  Very Strongly Agree</label></div>

<div class="rows"><label>3.     Speaks clearly.</label><br>
<input type="hidden" name="type34-249" value="6PMultiple">
<label><input type="radio" name="34-249" id="341" value="1" validate="required:true" > 1 - Very Strongly Disagree</label> 
<label><input type="radio" name="34-249" id="342" value="2" > 2 -  Strongly Disagree</label> 
<label><input type="radio" name="34-249" id="343" value="3" > 3 -  Disagree</label> 
<label><input type="radio" name="34-249" id="344" value="4" > 4 -  Agree</label> 
<label><input type="radio" name="34-249" id="345" value="5" > 5 -  Strongly Agree</label> 
<label><input type="radio" name="34-249" id="346" value="6" > 6 -  Very Strongly Agree</label></div>

I had thought of running through all form elements:

for ( var i=0; i < document.form1.elements.length; i++ ) {
    if ( document.form1.elements[i].type == "radio" ) {
        //Something
    }
}

My problem is that goes through each and every element, that would work for the select dropdowns (although not sure how to randomly select one of the dropdowns options once there), but that wouldn’t work for the radio’s name groups.

I had thought that for selecting dropdown options I could run this:

Math.random() * (max - min) + min

After getting the options count to randomly select one using the integer returned, I don’t know if that will work yet since I haven’t tested it since I’m stuck on the radio problem.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T20:31:04+00:00Added an answer on June 15, 2026 at 8:31 pm

    for the radio buttons, you could loop through the ‘rows’ div’s and get the child radio buttons from there:

    $("div.rows").each(function () {
        var radios = $(this).find("input[type=radio]");
        if (radios.length > 0) {
            var randomnumber = Math.floor(Math.random() * radios.length);
            radios[randomnumber].checked = true;
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have form with few buttons and I want to know what button is
I have installed VS2010 and MVC2 and testing a simple form using tinyMCE. When
I have form where are 2 input fields and then i have dynamic dataTables
I have form with 1 button. when you click on the button 3 others
I have form, where some fields are looks like rows, so I can add/delete
I have form with multiple input type=radio with text next to them. I want
In my Zend Framework project, I have a form that I am testing. In
Using Rails 3.0.7. I have a simple form which shows all records from one
I have a form in .module file. In the form submit button I am
I have a form that I want to close after 5 seconds if no

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.