I have a WP Data Table that I am trying to have one of the columns show as a dropdown menu in Gravity Forms and I am having difficulty doing so.
Can you help me link to some literature to follow or walk me through the process as a Premium member with the Gravity forms add-on. Its a basic license only on one site.
Th table is already linked to my google API and successfully updating.
add_filter( 'gform_pre_render', 'populate_dropdown_field' );
function populate_dropdown_field( $form ) {
global $wpdb;
// Change the table name and column name to match your wpDataTable
$table_name = 'wp_wpdatatable_5';
$column_name = 'Show Name';
// Retrieve the values from the specified column in the wpDataTable
$results = $wpdb->get_results(
$wpdb->prepare(
"SELECT DISTINCT %s FROM %s",
$column_name,
$table_name
)
);
// Loop through the form fields and find the dropdown field with the parameter name "daily_show_name"
foreach ( $form['fields'] as &$field ) {
if ( isset( $field->inputName ) && $field->inputName == 'daily_show_name' ) {
$choices = array();
foreach ( $results as $result ) {
$choices[] = array(
'text' => $result->$column_name,
'value' => $result->$column_name
);
}
$field->choices = $choices;
break;
}
}
return $form;
}
Firstly, I would like to sincerely apologize for the delayed response as we have been experiencing an unusually high number of tickets. I am sorry that it has taken longer than usual to respond to your concern and your patience is highly appreciated.
-
I can see that you resolved this and achieved what was needed for your use-case,
but just wanted to advise in general,
for custom solutions like this - it is not possible to achieve it with our built-in options so custom work is needed,
our support is not able to cover custom work like that.
. However, integration with other Gravity Forms add-ons isn’t confirmed, so we cannot guarantee that it will work and our support is not able to cover any troubleshooting for Gravity add-ons.
-
Basically, at the start of the ticket, you have described a use-case of "reverse method",
instead of making a dataTable that outputs data from a Gravity Form,
it seems you have connected our table to output data from a Google Spreadsheet,
and then made a custom function to pull a column from our table into the Gravity Form for a dropdown.
That is not something we tried before,
but thank you for sharing your custom solution, we will certainly share it with our developers for a possible future improvement idea.
I have a WP Data Table that I am trying to have one of the columns show as a dropdown menu in Gravity Forms and I am having difficulty doing so.
Can you help me link to some literature to follow or walk me through the process as a Premium member with the Gravity forms add-on. Its a basic license only on one site.
Th table is already linked to my google API and successfully updating.
I've added the following to my functions.php
I've also purchased the Gravity Wiz Populate Anything plugin which can pull directly from wordpress database.
Type: <sitename>
Table: wp_wpdatatables
Filters:
ID is "5"
and then I have the options to add another filter. (And/Or)
I've selected "And" then looked for where the column data is stored.
The column that I am looking for is column "2" named "CONTRACTDESCRIPTION".
What am I missing? I feel like I'm so close, but I can't get the wpdatatable information to populate on the Wordpress database.I resolved this myself by installing the google sheets add-on to the Gravity Wiz Populate Anything plugin.
It didn't pull from the WPdata table, but since the WPdat table was pulling from google sheets, i was able to do it that way.
(solved)
Hi, Jordan.
Firstly, I would like to sincerely apologize for the delayed response as we have been experiencing an unusually high number of tickets. I am sorry that it has taken longer than usual to respond to your concern and your patience is highly appreciated.
-
I can see that you resolved this and achieved what was needed for your use-case,
but just wanted to advise in general,
for custom solutions like this - it is not possible to achieve it with our built-in options so custom work is needed,
our support is not able to cover custom work like that.
-
Of course, you can always check our hooks for developers and see if you can find any that help,
and search resources such as Stack Overflow, for example;
I honestly don't fully understand all the details of how you managed to achieve this,
we will pass it to our developers to be aware that it's possible though;
but i can see that you mention Gravity Wiz Populate Anything plugin.
-
When it comes to anything with Gravity Plugins, we only have a native integration with the Gravity Forms.
Our Gravity Forms integration for wpDataTables add-on is working with wpDataTables plugin
and the core Gravity Forms plugin
. However, integration with other Gravity Forms add-ons isn’t confirmed, so we cannot guarantee that it will work and our support is not able to cover any troubleshooting for Gravity add-ons.
-
Basically, at the start of the ticket, you have described a use-case of "reverse method",
instead of making a dataTable that outputs data from a Gravity Form,
it seems you have connected our table to output data from a Google Spreadsheet,
and then made a custom function to pull a column from our table into the Gravity Form for a dropdown.
That is not something we tried before,
but thank you for sharing your custom solution, we will certainly share it with our developers for a possible future improvement idea.
Thanks again.
Kind Regards,
Miloš Jovanović
[email protected]
Rate my support
Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia demo sites | Docs | Discord Community
You can try wpDataTables add-ons before purchasing on these sandbox sites:
Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables