I have several text fields that are dynamically populated based on user choice from a drop down. Everything works wonderfully except the form does not "See" that the text fields have had content entered.
The text fields will trigger some conditional logic. When I manually enter the "condition" the form works properly. However, when the text fields are populated based on the drop down the form doesn't see that the content has been entered or changed.
How do i tell the form that the content has been entered and if it changes? This is the code I am using to get/pass/filter the content--everything works, when I submit the form the entered values are "seen" but they aren't while the form is still being worked on--I have several fields that are conditionally dependent on the group value that is passed.
I've has some great help getting this to work to this point and just need this last little bit to get this form to run perfectly.
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;
//populate a text field with the selected drop down value
jQuery("#input_4_63").val(machineName);
//populate a text field with the selected drop down value
jQuery("#input_4_62").val(machineGroup);
});
});
You can manually fire the change event after you dynamically populate the field, eg:
jQuery("#input_4_64").val(selectedValue).change();