Home > Net >  How do I force uppercase field entries in Gravity Forms to submit as lowercase?
How do I force uppercase field entries in Gravity Forms to submit as lowercase?

Time:06-17

This form, using Gravity Forms, is an artist application for a juried event, and we request their website and social media URLs. If there are any capitalized letters in the entry, Zapier cannot process these fields when processing them into Zoho CRM. The URL entries must all be lowercase. Using CSS to force lowercase didn't solve this, as the field entry would still be uppercase in the database. So now I'm trying to use functions. However, the code below is not working. Thank you for any help you can provide with this!

add_filter( 'gform_save_field_value_8_54', 'lowercase_text', 10, 3 );
function lowercase_text( $value, $entry, $field ) {
if ( $field->get_input_type() == 'text' ) {
    $value = strtolower( $value );
}

return $value;
}

add_filter( 'gform_save_field_value_8_55', 'lowercase_text_fb', 10, 3 );
function lowercase_text_fb( $value, $entry, $field ) {
if ( $field->get_input_type() == 'text' ) {
    $value = strtolower( $value );
}

return $value;
}

add_filter( 'gform_save_field_value_8_67', 'lowercase_text_insta', 10, 3 );
function lowercase_text_insta( $value, $entry, $field ) {
if ( $field->get_input_type() == 'text' ) {
    $value = strtolower( $value );
}

return $value;
}

CodePudding user response:

Hello thank you for question,

Try below hook it will work

add_action("gform_pre_submission_8", "pre_submission_handler");
function pre_submission_handler($form)
{
   $_POST["input_54"] = strtolower($_POST['input_54']);
   $_POST["input_55"] = strtolower($_POST['input_55']);
   $_POST["input_67"] = strtolower($_POST['input_67']);
}
  • Related