I'm trying to pass the value of a drop down field that has been dynamically populated via the CSS method outlined on this forum and it works fine and can be seen here:
When the form is submitted I want to take the value in the field and copy it to a hidden field which creates the post title via the Custom Post Types Addon. This works fine with every other field but not these, I've tried turning the advanced interface off but it makes no difference. I've tried various methods and nothing seems to work, here are the two methods I know work with other fields:
add_filter('gform_pre_render_3', 'fill_med_fields');
function fill_med_fields($form) {
?>
<script type="text/javascript">
jQuery(document).ready(function($){
// update "#input_74_9" to the HTML ID of your field from which the value will be retrieved
$('#input_3_9').blur(function(){
// update the "#input_74_11" to the HTML ID of the field that should be updated
$('#input_3_1').val($(this).val());
}); // update "#input_74_9" to the HTML ID of your field from which the value will be retrieved
});
</script>
<?php
return $form;
}
add_action('gform_pre_submission_3', 'populate_med_title');
function populate_med_name(){
$_POST["input_3"] = $_POST["input_1"]; //Set the contents of field 18 to the same as field 6
}
The only other method I can think of is to manually edit the post data after it's been stored and this seems a bit overkill considering it should work fine. Normally drop down fields aren't a problem so I think it is purely due to this method of dynamically populating
Also it seems this method of populating causes issues with the Required option as even when you've selected an option it will throw an error.