Do you guys know how to prepopulate a dropdown from a csv file on the server?
I would do it through the admin area, but the file is 30,000+ lines so that admin interface freezes when I try to save the form.
This is what I attempted with, but no luck
add_filter('gform_pre_render_7', 'GF_prepopulate_2');
function GF_prepopulate_2($form){
foreach($form["fields"] as &$field){
if($field["id"] == 15){
$csv = array();
$file = fopen('http://example.com/mf.csv', 'r');
while (($result = fgetcsv($file)) !== false)
{
$csv[] = $result;
}
fclose($file);
foreach ($csv as $line){
$field['choices'][] = array( 'text' => $line, 'value' => $line);
}
}
}
return $form;
}