Advertisement
chrishajer

strtoupper some fields after submission

Oct 24th, 2011
2,010
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. // http://www.gravityhelp.com/forums/topic/convert-form-field-text-to-uppercase
  3. // change the 1 here to your form ID if it's not form 1
  4. add_action('gform_pre_submission_1', 'capitalize_fields');
  5. function capitalize_fields($form){
  6.     // add all the field IDs you want to capitalize, to this array
  7.     $fields_to_cap = array(
  8.                     'input_1',
  9.                     'input_19',
  10.                     'input_1',
  11.                     'input_19',
  12.                     'input_20',
  13.                     'input_21',
  14.                     'input_3',
  15.                     'input_22',
  16.                     'input_4',
  17.                     'input_5',
  18.                     'input_18',
  19.                     'input_24',
  20.                     'input_10',
  21.                     'input_11',
  22.                     'input_13',
  23.                     'input_14',
  24.                     'input_15',
  25.                     'input_28');
  26.     foreach ($fields_to_cap as $each) {
  27.         // for each field, convert the submitted value to uppercase and assign back to the POST variable
  28.         // the rgpost function strips slashes
  29.         $_POST[$each] = strtoupper(rgpost($each));
  30.     }
  31.     // return the form, even though we did not modify it
  32.     return $form;
  33. }
  34.  
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement