So here is how this will have to be done. It's a little bit of a work around.
What you will have to do is add a TEXT FIELD to your form and name it what you want the post title drop down to be. What we need to do is use PHP code to change the display of a TEXT FIELD into a drop down. So instead of adding a drop down to your form, add a text field. The information will be stored in this text field.
Here is the code snippet that will transform this text field into a drop down that consists of post titles for a given category id...
Note, you will need to change the FORM ID, the CATEGORY, and the FIELD ID in this code snippet.
The form id you need to change is the 14 in this piece of the code snippet above:
add_filter("gform_pre_render_14", populate_dropdown);
The category you need to change is the name in this piece of the code snippet above:
$posts = get_posts("category=Business");
The field id you need to change is the id in this piece of the code snippet above:
if($field["id"] == 8){
You can get the field id by viewing source on the form front end, finding the field we are targeting and getting the id.
Posted 15 years ago on Tuesday January 12, 2010 |
Permalink