Trim Spaces in IBAN Field [RESOLVED]

Dear community, hope you can help!

In my form I have an input-field “IBAN”.
I use “Limit submissions”-perk to limit the same information in this field so it cannot be submitted twice.

So if I have one entry with iban field “AT1234567890” i cannot submit another entry with this value.
But a submission with the same IBAN but with spaces in between like “AT 123 456 7890” will be allowed.

How can I manage to avoid this?
Best solution for my purposes would be to trim all the spaces after submission before it is saved. Is there a way to do this? Or do you have other suggestions?

Thank you!

Bye, Michael

Hi Michael. You can use the gform_save_field_value filter, like this:

add_filter( "gform_save_field_value", "remove_spaces", 10, 4 );
function remove_spaces($value, $entry, $field, $form){
    $new_value = str_replace(' ', '', $value);
    return $new_value;

That is PHP code which can go into your theme functions.php file, or a custom functionality plugin if you are using one. That will replace the space ' ' with no space '' and save the value before the entry is created.

1 Like

Thank you very much for your help, worked fine!

1 Like
© 2008 - 2021. Gravity Forms is a project by Rocketgenius Inc.