Hi, is there a way to automatically remove spaces and dashes in the phone field? So that if the client enters the telephone number in the wrong format it will automatically be corrected.
example client input like this:
+60 1234-56789
Autofix to:
+60123456789
I’m currently using the additional Smartphone field for the Gravity Forms plugin to add flags and use the phone field (international)
There’s no built-in feature to remove specific characters from the field values, but you could use the gform_save_field_value filter and some custom code to remove those characters before saving the value into the database. The filter documentation has an example that points you into the right direction: docs.gravityforms.cm/gform_save_field_value/#h-5-remove-new-lines-tabs-and-carriage-returns*
Please check the following link for details and options available to insert custom PHP code: docs.gravityforms.cm/where-do-i-put-this-code/php*
Note that this filter will only affect the values that are being sent through ActiveCampaign feeds. If you want to apply the same transformation for values saved in Gravity Forms, you will want to also hook into the filter gform_save_field_value.
Hi, Joshua, can you help me with how to do it, I have tried several ways not working.
I only need a way to automatically remove spaces and dashes in the phone field? So that if the client enters the telephone number in the wrong format it will automatically be corrected.
example client input like this:
+60 1234-56789
Autofix to:
+60123456789
I’m currently using the additional Smartphone field for the Gravity Forms plugin to add flags and use the phone field (international)
If you are willing to change the phone field to a single-line text field you can then change the input mask. I’ve attached a screenshot with a few steps. Also, a documentation link is below.
Hi Derek, thanks, Our client wants to add a country flag on the phone field.
And it requires an additional Smartphone field plugin for the Gravity Forms plugin to add flags and this plugin needs to use a phone field (international).
With this add-on, which you might be referring to, according to their documentation you can select one input mask and apply it for all countries while still keeping the flags. The link above has a screenshot of the settings you need to toggle to do this .