maelle

Pre Submission Filter Code

Nov 4th, 2011
73
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // customize user notification message
  2. add_filter('gform_pre_submission_filter_1', 'conditional_message');
  3. function conditional_message($form){
  4.  
  5. // define conditional on payment options field
  6. $choice1 = RGForms::post('input_50_1');
  7. $choice2 = RGForms::post('input_50_2');
  8.  
  9. // if any box was checked, display a message. Since field is required, this will always test TRUE
  10. if($choice1 || $choice2)
  11. $form['autoResponder']['message'] .= "Hello, Message.";
  12.  
  13. // append a different PDF link based on the interest
  14. if($choice1)
  15. $form['autoResponder']['message'] .= "<p>Here are the payment details...</p>";
  16. if($choice2)
  17. $form['autoResponder']['message'] .= "<p>Here are the payment details...</p>";
  18.  
  19. // return modified form
  20. return $form;
  21. }
  22.  
RAW Paste Data