Hi again,
is there a way to make the "title" field of an "post image field" a required field?
Hi again,
is there a way to make the "title" field of an "post image field" a required field?
There is a required checkbox for the post title field. Does that not work? I've never tried it without entering a title, when it was checked as required.
Hi Chris,
I do not mean the "post title". Sorry! I mean the "post image field". Under post images you have the option of letting users enter a title, caption and description.
When title is ticked, it shows the user a title sub-field. How can I make this sub-field required?
Hi sascha, sorry about that. I misread it the first time around. I will find out for you. If it's not possible, you might be able to do it with another field in the form, just a text field, called "Image Title" and make that required. Then, in your content template, use that field as the title attribute of the img tag. Would that work?
HI Chris,
Not sure if that would work with the content template. I need the uploaded image to have that information in the title also when I go to my wordpress backend. Other plugins/functions display the title. so it must be available.
Could I use the gform_after_submission hook to add the title from that new field to the attachment data? Not sure how to do this though.
Hi again,
or even better could the title/caption/description fields be made to be populated dynamically or have a content template? Then I could generate those from other fields in the form...
The post image field doesn't support the content template functionality.
In order to do what you want to do you'd have to write custom validation using the gform_validation hook to make the Post Image Title field required.
Here is a tutorial on how to use the gform_validation hook to create custom validation:
http://www.gravityhelp.com/documentation/page/Using_the_Gravity_Forms_%22gform_validation%22_Hook
Thanks Carl,
Ok, I will look into that. Good idea to do a custom validation! How will I be able to set required class at the same time? Jquery? Would you know how?
Hi sascha, take a look at this solution posted by Alex:
You would add code to your theme's functions.php making it required and forcing the validation to know it's required as well.