Hello,
Might be right in front of my face, but I haven't found a way to get this working. I'd like to dynamically set the default radio button selection using a hook like gform_pre_render. I've be trying things along the lines of the attached code.
Essentially, I could use help understanding how to force the form to have a choice (doesn't matter which) selected upon page load. If I can get there, I believe I can take it the rest of the way myself. Any help is much appreciated!
add_filter( "gform_pre_render_3", "set_default_dynamically" );
function set_default_dynamically($form) {
foreach( $form["fields"] as $field ){
if( $field["id"] == 4 ){
$field["choices"][0]["isSelected"] = 1;
}
}
return $form;
}