We help IT Professionals succeed at work.
Get Started

Select Option from another forms radio button

Robert Granlund
on
65 Views
Last Modified: 2015-12-30
I have two forms on a page.  One form has radio buttons.  All of the values of the radio buttons are equal to the values of Select Options on another form.  If a user clicks on one of the radio buttons on form 1  I want to automatically change the selected on form two to the that value of the radio button.

var sensorpick is from the raio button and $sensors is the ID of the Select on the second form:
<script>
$("#sensor-choose").change(function() {
	var sensorpick = $("input:radio[name='sensor-choose']:checked").val();
	$('#sensor option[value="' + sensorpick+ + '"]').prop('selected', true);
		});


<html>
<form method="GET" id="sensor_finder">	
	
		if you already have a Coherent sensor or meter, please make your selection below.<br />
	<!--  START Find a Sensor  -->	
		<div class="form-control">
			<select name="sensor" id="sensors">
				<option value="">Find a Sensor</option>
				{exp:channel:entries channel="measurement" dynamic="no"}
					{if sensor_or_meter == "Sensor"}
						<option value="{measurement_product_name}">{measurement_product_name}</option>
					{/if}
				{/exp:channel:entries}
			</select>
		</div>

Open in new window

Comment
Watch Question
CERTIFIED EXPERT
Fellow
Most Valuable Expert 2017
Commented:
This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE