Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // http://www.gravityhelp.com/forums/topic/convert-form-field-text-to-uppercase
- // change the 1 here to your form ID if it's not form 1
- add_action('gform_pre_submission_1', 'capitalize_fields');
- function capitalize_fields($form){
- // add all the field IDs you want to capitalize, to this array
- $fields_to_cap = array(
- 'input_1',
- 'input_19',
- 'input_1',
- 'input_19',
- 'input_20',
- 'input_21',
- 'input_3',
- 'input_22',
- 'input_4',
- 'input_5',
- 'input_18',
- 'input_24',
- 'input_10',
- 'input_11',
- 'input_13',
- 'input_14',
- 'input_15',
- 'input_28');
- foreach ($fields_to_cap as $each) {
- // for each field, convert the submitted value to uppercase and assign back to the POST variable
- // the rgpost function strips slashes
- $_POST[$each] = strtoupper(rgpost($each));
- }
- // return the form, even though we did not modify it
- return $form;
- }
Advertisement
Advertisement
Advertisement
RAW Paste Data
Copied
Advertisement