There aren't any errors at all. If I override the dropdown (which works fine), it seems to ignore that the form is associated with paypal, and the form will submit like a normal form.
Here is the function that I'm using....
add_filter('gform_pre_render_5', 'custom_event_tickets');
function custom_event_tickets($form_meta) {
global $sp_ecp;
$formId = $form_meta['id'];
$options = sp_get_events('100');
//print_r_html ($form_meta);
//Creating drop down item array.
$items = array();
//Adding initial blank value.
$items[] = array("text" => "Choose...", "value" => "Choose...", "isSelected" => "1", "price"=>'$0.00');
//Adding Available Events and prices to the items array
foreach ( $options as $option )
{
$cost = sp_get_cost($option->ID);
if ($cost == "Free") $cost = "$0";
$items[] = array("value" => $option->post_title . '... ' .$cost, "text" => $option->post_title . '... ' .$cost, "isSelected" => "", "price" => $cost . ".00" );
}
foreach($form_meta["fields"] as &$field) {
if($field["id"] == 1)
{
$field["type"] = "select";
$field["choices"] = $items;
}
}
//print_r_html ($form_meta);
return $form_meta;
}
my choices array looks like this before I make the change (this works fine):
[choices] => Array
(
[0] => Array
(
[text] =>First Choice
[value] => First Choice
[isSelected] => 1
[price] => $10.00
)
[1] => Array
(
[text] => Second Choice
[value] => Second Choice
[isSelected] =>
[price] =>$12.00
)
[2] => Array
(
[text] => Third Choice
[value] => Third Choice
[isSelected] =>
[price] => $15.00
)
)
I made sure that my dynamic array showed the same info, the same way, which looks like this:
[choices] => Array
(
[0] => Array
(
[text] => Choose...
[value] => Choose...
[isSelected] => 1
[price] => $0.00
)
[1] => Array
(
[value] => Nathan Angelo... $10
[text] => Nathan Angelo... $10
[isSelected] =>
[price] => $10.00
)
[2] => Array
(
[value] => Marvin & Leanda King... $0
[text] => Marvin & Leanda King... $0
[isSelected] =>
[price] => $0.00
)
[3] => Array
(
[value] => Parachute Musical / Mike Mains... $10
[text] => Parachute Musical / Mike Mains... $10
[isSelected] =>
[price] => $10.00
)
I might easily be overlooking something. I appreciate the help.
Posted 13 years ago on Tuesday April 19, 2011 |
Permalink