I may have it working with
//Adds a filter to form id 14. Replace 14 with your actual form id
add_filter("gform_pre_render_1", populate_dropdown);
function populate_dropdown($form){
global $sp_photo_only;
global $sp_photo_only_desc;
global $sp_mounted;
global $sp_mounted_desc;
global $sp_folding;
global $sp_folding_inside;
$choices = array(array('text' => $sp_photo_only_desc,
'value' => $sp_photo_only_desc,
'price' => $sp_photo_only
),
array('text' => $sp_mounted_desc,
'value' => $sp_mounted_desc,
'price' => $sp_mounted
)
);
//Adding items to field id 8. Replace 8 with your actual field id. You can get the field id by looking at the input name in the markup.
foreach($form["fields"] as &$field)
if($field["id"] == 35){
$field["type"] = "select";
$field["choices"] = $choices;
}
return $form;
}
Will update after testing.
Posted 12 years ago on Thursday July 19, 2012 |
Permalink