I am not sure how I would do that--well, I can see how to do that, but writing individual conditions would make a very long set of conditional logic and not be quite as dynamic as I am hoping for--the drop down is generated from a Taxonomy. I was hoping to utilize this "filter" I have written
This is what I am working with:
add_filter("gform_pre_render_4", "monitor_dropdown");
function monitor_dropdown($form){
?>
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery('#input_4_40').bind('change', function()
{
//get selected value from drop down;
var selectedValue = jQuery("#input_4_40").val();
//populate a text field with the selected drop down value
jQuery("#input_4_64").val(selectedValue);
});
});
$(function(){
var groupFromValue = {
227: {
name: 'B-1300SS',
group: '8'
},
228: {
name: 'B-1500SS',
group: '3'
},
235: {
name: 'SG4600-72',
group: '9'
}
}
$('select').change(function() {
var machineName = groupFromValue[$(this).val()].name;
var machineGroup = groupFromValue[$(this).val()].group;
jQuery("#input_4_63").val(machineName);
jQuery("#input_4_62").val(machineGroup);
});
});
</script>
<?php
return $form;
}
I filter the value and name to come up with group. based on teh data input into the field (in this case (machineGroup) i am trying to use that value to trigger a few input fields on the form. I am doing it this way because i have over 50 machines which are sorted into 3 machineGroup
Posted 12 years ago on Monday June 18, 2012 |
Permalink