My use case is to allow users to click a button from a wpDataTable table they are viewing.
The new form displays a list of related records in a different wpDataTable. The records are filtered by the ID field in the first table using the wdt_column_filter[1] parameter in the URL used to open the form.
If the user wants to add a new record in the second table, I do not want them to have to enter the foreign key. I set the Predefined value(s) value to %Var1% under the Editing table for the Foreign Key field. I attempted to pass the value as follows: https://myurl/notes/?wdt_column_filter[1]=7507&%VAR1%=7507
This does not work. Is there a way, I can set set values to be written to the database when the user performs adds a new record with out making the user enter the data?
Sorry for the late response, and sorry for the spammer responses you received yesterday.
The only way you could achieve this is with the CONCAT function. You can't configure the predefined value for a table that has a foreign key set. If a column is pulling the data from a foreign key, the only available edit type is a single-value selectbox. The values for the selectbox need to be populated in another table.
Then, with the CONCAT function, you'd be able to define the column's data as URL + VALUE as shown in the example in the video linked above.
Hi,
My use case is to allow users to click a button from a wpDataTable table they are viewing.
The new form displays a list of related records in a different wpDataTable. The records are filtered by the ID field in the first table using the wdt_column_filter[1] parameter in the URL used to open the form.
If the user wants to add a new record in the second table, I do not want them to have to enter the foreign key. I set the Predefined value(s) value to %Var1% under the Editing table for the Foreign Key field. I attempted to pass the value as follows: https://myurl/notes/?wdt_column_filter[1]=7507&%VAR1%=7507
This does not work. Is there a way, I can set set values to be written to the database when the user performs adds a new record with out making the user enter the data?
Thanks,
Scott
Hey Scott
Sorry for the late response, and sorry for the spammer responses you received yesterday.
The only way you could achieve this is with the CONCAT function. You can't configure the predefined value for a table that has a foreign key set. If a column is pulling the data from a foreign key, the only available edit type is a single-value selectbox. The values for the selectbox need to be populated in another table.
Then, with the CONCAT function, you'd be able to define the column's data as URL + VALUE as shown in the example in the video linked above.
Kind Regards,
Aleksandar Vuković
[email protected]
Rate my support
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