Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions gravity-forms/gw-capitilize-submitted-data.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
add_action( 'gform_pre_submission_123', 'gw_capitalize_submitted_data' );
function gw_capitalize_submitted_data( $form ) {

$applicable_input_types = array( 'address', 'text', 'textarea', 'name' );
$applicable_input_types = array( 'address', 'text', 'textarea', 'name', 'list' );

foreach ( $form['fields'] as $field ) {

Expand All @@ -27,8 +27,14 @@ function gw_capitalize_submitted_data( $form ) {
$_POST[ $input_key ] = ucwords( strtolower( rgpost( $input_key ) ) );
}
} else {
$input_key = sprintf( 'input_%s', $field['id'] );
$_POST[ $input_key ] = ucwords( strtolower( rgpost( $input_key ) ) );
$input_key = sprintf( 'input_%s', $field['id'] );
if ( $field->type == 'list' ) {
$_POST[ $input_key ] = array_map( function( $value ) {
return ucwords( strtolower( $value ) );
}, $_POST[ $input_key ] );
Comment on lines +32 to +34
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work with multi-column List fields?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it works fine with multi column list fields as well.

} else {
$_POST[ $input_key ] = ucwords( strtolower( rgpost( $input_key ) ) );
}
}
}

Expand Down
Loading