Search code examples
wordpressgravity-forms-plugin

How to prevent users from deleting pre-populated values in Gravity Forms?


Is there any specific way to prevent users from deleting pre-populated values in Gravity Forms? I wish to append a static country code in the phone field but still allow the full phone number to be filled by the end user.

Thanks!


Solution

  • This is not a perfect solution, but it might work for you.

    1. Add a Single Line Text field to your form.
    2. Enable the "Input Mask" setting.
    3. Set the mask to "Custom" and enter a custom mask (example).

    Any number besides "9" will appear as a "static" value when the user selects the field. Then use "9" to indicate a digit the user would enter themselves. Here is what my example in Step 3 would look like on the frontend (screenshot).