Link to home
Avatar of Robert Granlund
Robert GranlundFlag for United States of America

asked on

Select Option from another forms radio button

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

Avatar of sajayj2009
sajayj2009

You are using id for multiple radios?
ASKER CERTIFIED SOLUTION
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial