Hi,
I'm trying to dynamically control the confirmation message that is displayed based on the results of a 3rd party API call invoked in the gform_post_submission hook. The message returned is always the one defined in the form as the confirmation message. From looking at the Form Object documentation, it looks like this should be possible. Thoughts?
add_action( 'gform_post_submission_1', 'doSubscribe', 10, 2 );
function doSubscribe( $entry, $form )
{
...
$form["confirmation"]["type"] = "message";
switch ( $api->resultCode )
{
case 10:
$form["confirmation"]["message"] = "Already subscribed.";
break;
case 20:
$form["confirmation"]["message"] = "Pending confirmation.";
break;
default:
$form["confirmation"]["message"] = "General error";
break;
}
}