Advertisement
chrishajer

Modify option field and store value before pipe

Dec 27th, 2012
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.64 KB | None | 0 0
  1. <?php
  2. // http://www.gravityhelp.com/forums/topic/change-option-value?replies=19#post-103945
  3. // change the 241 here to your form ID
  4. add_action('gform_pre_submission_filter_241', 'strip_pricing');
  5. function strip_pricing($form) {
  6.  
  7.         // split input_1 on the pipe symbol and use the first part
  8.         $haystack = $_POST['input_1'];
  9.         $needle   = '|';
  10.         $result   = substr($haystack, 0, strpos($haystack, $needle));
  11.  
  12.         // assign the result to the hidden field in the form
  13.         // update the 58 here to the ID of your hidden field
  14.         $_POST['input_58'] = $result;
  15.  
  16.         // return the form
  17.         return $form;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement