I came across the same issue and welcome corrections/feedback to the approach below. In addition to fully enabling GF’s dynamic population, this appears to be an alternative resolution to the problem of wysiwyg field content not being retained when validation fails, discussed here. It could also be an opportunity to incorporate the wp media button, as discussed here.
Because we’ll replace the functionality of the wysiwyg_enqueue_scripts() function elsewhere, comment out line 27 in the file gf_wysiwyg_class.php:
// add_action( 'gform_enqueue_scripts' , array(&$this, 'wysiwyg_enqueue_scripts') , 10 , 2 );
For good measure, comment out the entire associated wysiwyg_enqueue_scripts() function starting on line 105. We’ll insert its functionality into the wysiwyg_field_input() function where we have access to the $value parameter we’ll pass to the wp_editor() function for dynamic population. Go ahead and replace the entire wysiwyg_field_input() function (starts on line 67) with this:
function wysiwyg_field_input( $input, $field, $value, $lead_id, $form_id ) {
if ( $this->is_wysiwyg($field) ) {
$input_id = 'input_' . $form_id . '_' . $field["id"];
if (is_admin()) {
$tabindex = GFCommon::get_tabindex();
return sprintf("<div class='ginput_container'><textarea readonly name='input_%s' id='input_%s' class='textarea gform_wysiwyg' {$tabindex} rows='10' cols='50'>WYSIWYG editor</textarea></div>", $field["id"], 'wysiwyg-'.$field['id']);
} else {
$args = array(
'textarea_name' => 'input_'.$field["id"],
'wpautop' => true,
'media_buttons' => false, // possibly true
'editor_class' => 'frontend',
'textarea_rows' => 5,
'tabindex' => 0 //$tabindex
);
ob_start();
wp_editor($value, $input_id, $args);
$html = ob_get_contents();
ob_end_clean();
return "<div class='ginput_container'>" . $html . "</div>";
}
}
return false;
}
I tested the above with WP v3.4.2, GF v1.6.10, and GF + WYSIWYG v0.1 beta. It works for me with all methods of dynamic population I’m aware of (query string, shortcode, hooks, $field_values parameter of gravity_form() function, and “Default Value” set for field in the form editor in the admin).
Obviously, you’ll want to test it fully before using on your production site. As time permits, maybe the plugin author will comment on whether this breaks something and whether it fits with the rest of the code conceptually.