Okay
  Public Ticket #3689684
Formidable Forms Query Criteria
Closed

Comments

  • Tim Henthorn started the conversation

    When creating a table connecting to a FormidableForms form, there isn't an option to limit what rows will be in the table via criteria or filter.  While you can apply a wpDataTable filter, I couldn't find a way to hide a filter with a Placeholder or apply a filter to the underlying SQL query.

    I just want to be able to pull a subset of the table records from my FormidableForms form and only include those in the table.  Then I want to apply all of the standard wpDataTable features to this as a data source.  Am I missing a way to do this?

  •  1,819
    Miloš replied


    Hi Tim,

    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.


    1. In terms of limiting the rows shown, if you mean to filter them, you can easily achieve this for Formiable Forms.

    Please check all our available Advanced filters here.


    2. If you have some predefined filter on a column from your Table linked to Formidable Form and wish to hide it, so users can't clear the filter to see all data, there is a workaround via CSS:

    Here is an example how you can pre-filter a Formidable Table for the logged in user ID, then you can use the same principle for any other kind of filter you need :


    Regarding filtering a Formidable table for currently logged user ID ( to show only entries which that user submitted),

    i will show an example workaround, and also how you can use CSS to hide the column filter if you wish to prevent users from "clearing the filter" and see other people's rows.

    -

    First we need to add a hidden Field in the Form to store the "user ID" information.

    5146824406.png

    -

    I will show you a working example for a table connected with Forminator Form,

    but you can use absolutely the same principle for the table connected to a Formidable Form.


    Here is my 'test example' with just a very basic Form and one Text field.

    Since we already added that hidden "user ID" field in the Form,

    i just added a couple of submissions.

    The first one by my Admin user, which has user ID of 1;

    then i log as another user, with user ID of 11, and add another submission.

    By default, i have just left the field name without setting it up at the Form, and the table picks up this field as origin header of "hidden1".

    6733523157.png
    6107479450.png

    We can change the Displayed Header name to anything, i name it "user ID",

    and of course, you can hide that column from front-end users if needed, i just left it for demonstration purpose.

    -

    Now, i will explain how you can use this user ID field to pre-filter the table for front-end users,

    and also you can hide the filter with CSS - to prevent any user to "clear the filter" in order to see everyone's subbmisions.

    -

    This is a detailed example of using an Excel table - but you can use absolutely the same principle/logic for table linked with your Forminator Form.

    - On this Excel, we added a custom "user_id" column on the source Excel side, which you can hide if needed in our plugin from the front-end.   ( On your Form, you will already have that hidden user ID field as mentioned above);

    We will add a predefined filter value to that column, using a PlaceHolder "Current User ID";

    - Check that the filter type is set as "Text", as shown on this screenshot.

    8249361981.png

    - Here is how an example table linked to a source file looks before we make any changes, with visible filters above the table.

    7932387639.png

    And now, when we set the pre-filter, with Administrator logged in ( In our case, the user ID is 1), we only see rows matching that user ID.

    3633379684.png

    - (If you need more detailed information about using Place Holders in wpDataTables, here is our documentation about that https://wpdatatables.com/documentation/table-features/using-placeholders/);



    - The user_ID filter is still visible, which means, if someone changes/deletes this value, they could see the whole table.

    We will hide it from the front-end with some custom CSS added in the "Customize" section of the main table settings.

    - It should be easy to do, depending on your knowledge of HTML and CSS.

    You have to find the correct selector using the browser inspector tool, add the style "display:none" property to it, and it will disappear from the front-end.

    On our example table, the custom CSS is :

    #table_1_5_filter_sections  {
        display:none; }
    5537273103.png

    - Now, the user_ID filter is gone from the front-end.

    8120839900.png

    - Optionally, you can hide the user_id column from the front-end, if needed, either using the column settings tab or the "column list" button from the back end Admin area.

    1618300341.png

    - If you need more details about this, don't hesitate to contact us further.


    3. Now, you mentioned an SQL Query.

    Our Plugin is using advanced functionality which pulls the data through our integration with Formidable, of course, but I am unable to disclose the full details how all that is made, it is custom made by our developers.


    If you plan to use an SQL Query to pull the data from a Formidable Form, that will be a difficult task, because the data is stored in the WordPress Database as data from Formidable Plugin in multiple SQL tables and in serialized JSON format.

    So if you plan to pull that, you need custom SQL Query based Table, that is not covered by our support.

    And if you manage to pull the data, in the end you also need to unserialize JSON to make it more humanly readable.


    But it is much easier to simply use our integration and just link the Table from the Formidable Form.

    Then you can use filters, hide filter with CSS as shown above;


    You can also use a Placeholder, it just depends exactly which placeholder you wish. If you want a VAR placeholder, it can only be used on a Text filter type on a Column.

    As shown above on the "current User ID" placeholder example, on that one it also must be a Text filter only.


    Let me know if this covers all details or if you have any questions.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia 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