Gravity Forms v1.9 Placeholders
By Carl Hancock Published October 7, 2014One of the most requested features and one that we’ve gotten a lot of flak for over the last couple years for not having as a built-in feature is finally available in Gravity Forms v1.9: Placeholders.
Placeholders had not previously been available for a variety of reasons. We originally wanted to use a pure HTML5 approach with no additional javascript but that meant waiting until placeholder browser support was available across the board. Once browser support was there we had to fit it into our internal development roadmap.
We also wanted to make sure that we introduced Placeholders as a feature that provides as much flexibility as possible. We weren’t content with simply using the Field Label or Sub-Labels as the Placeholder. We held off until we could devote the time to implement the feature the correct way rather than taking shortcuts.
The wait is over. Placeholders are now available in Gravity Forms v1.9 Beta 1 which is available for Gravity Forms customers who would like to use it right now via the downloads page. You can read more about all of the features in Gravity Forms v1.9 via the Gravity Forms v1.9 Beta 1 release post.
What are Placeholders?
For those of you who are not familiar with placeholders, it is an HTML5 input attribute that allows you to provide text within a form input that goes away when the input has focus. This is helpful for providing additional guidance, or if you’d like to rely solely on placeholders instead of displaying Field Labels or Sub-Labels.
How To Add Placeholders
Enabling placeholders on a field in Gravity Forms is a simple as adding the text you’d like to use as the placeholder within the Field Editor.
Simply edit the Form containing the Field you’d like to add placeholders to, edit the specific Field, select the Advanced Tab and then customize the text you’d like to appear as the placeholder value. If you are adding placeholders to an Advanced Field such as the Name Field or Address Field you will be presented with multiple placeholder inputs, one for each of the inputs in the field.
Save your form and that’s it!
What If I’d Like To Rely Only on Placeholders?
It’s not uncommon for people to present a simple form by only using placeholders and without any additional UI such as the Field Labels or Sub-Labels. That is most definitely possible with the new placeholder functionality in Gravity Forms.
You can now control the visibility of the Field Label both with the Form Settings which applies to the entire form, or via the Advanced Tab of the Field Editor if you’d like to do it for a specific field. Simply select hidden from the new Field Label Visibility setting.
add_filter( 'gform_enable_field_label_visibility_settings', '__return_true' );
Taking things a step further you can also hide the visibility of Sub-Labels on Advanced Fields such as the Name Field or Address Field. There is a new Sub-Label Placement setting within the Advanced tab of the Field Editor that allows you to configure the placement of the Sub-Labels: Below Inputs (the default), Above Inputs (new option), or Hidden (new option).
We have provided users with the flexibility to make use of any combination of Field Labels, Sub-Labels, Placeholders, Field Description and Default Values.
But Wait, There’s More…
Not satisfied with stopping at placeholders for inputs we have also carried over this functionality to Drop Down Fields to enable placeholders that previously required using the first choice as the placeholder.
If the Drop Down is a required field then the user will be required to make a selection. The placeholder is not an actual value and therefore will fail validation.
It’s Not About Being First.
We tackled Placeholders the way we tackle everything we do here at Rocketgenius. Our goal is to produce the best product. We are not concerned with being the first to market with a feature or rushing to introduce a feature just because our competitors have it. That isn’t how we do things and it isn’t how anyone should do product development.
While this may frustrate some users who want a feature that is currently unavailable, the end result is a better product.
Please Note: Documentation for the features and functionality introduced in Gravity Forms v1.9 is still in progress. We are completely overhauling all of the Gravity Forms documentation and will be launching an entirely new site soon.