So my client has a form where some fields are required and others are not. However, if a field is not required and the user doesnt fill it in, it needs to be submitted with the text “NA” (this is required by the state for this particular form). I thought about using a placeholder with NA, but it looks confusing to the user in my opinion if they do want to fill out that field. Is there a way to have a default text submitted if the field is empty but not visible to the user filling out the form?
You can add any placeholder text you want and then use display:none CSS rule to hide the placeholder text.
Actually, thinking about this, i think it would be a “default value” instead of a placeholder so that when the form is submitted, it comes through to the entry as NA if the user doesnt fill it in. Can you target a default value with css?
Yes you can and you can even make the color the same color as the field inputs background.
Thanks but I dont know how to hide the default value because I dont know what css tags to use…? Anyone know or another way, like a if/or code in the functions that says that if a field is left empty, then use NA in the entry or something like that?
I think that would need a custom snippet written to change the value after submission if the field is empty. I did a check of Gravity Forms docs and can’t seem to find one that would work out of the box.
Here buddy this should get you started:
::-webkit-input-placeholder { /* Edge */
color: red;
}
:-ms-input-placeholder { /* Internet Explorer 10-11 */
color: red;
}
::placeholder {
color: red;
}