Advertisement
chrishajer

Conditional PDF

Aug 12th, 2011
538
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // update the "19" to the ID of your form
  2. add_filter('gform_pre_submission_filter_19', 'conditional_message');
  3. function conditional_message($form){
  4.    
  5.         // update the "3" following "input_" to the ID of your field
  6.         $interest = RGForms::post('input_3');
  7.  
  8.     // append a different PDF link based on the interest
  9.     // I used values to avoid capitalization and spaces in my values
  10.     switch($interest) {
  11.         case 'beltguard':
  12.             $form['autoResponder']['message'] .= "<a href='http://www.example.com/whitepapers/belt-guards.pdf' title='Download your free Belt Guard whitepaper'>Belt Guards</a></p>";
  13.             break;
  14.         case 'safetyguard':
  15.             $form['autoResponder']['message'] .= "<a href='http://www.example.com/whitepapers/safety-guards.pdf' title='Download your free Safety Guard whitepaper'>Safety Guards</a></p>";
  16.             break;
  17.         case 'catalogue':
  18.             $form['autoResponder']['message'] .= "<a href='http://www.example.com/whitepapers/2011-catalogue.pdf' title='Download your free Catalogue here'>Catalogue</a></p>";
  19.             break;
  20.     }
  21.    
  22.     // return modified form
  23.     return $form;
  24. }
Advertisement
RAW Paste Data Copied
Advertisement