Forums

DB read where based on dropdown

Roaf 11 Feb, 2019
Hi,

I cant seem to get this to work properly. I have a CC6 table view where it pulls up a list of reservations.

The reservation date field is not a normal datetime, but a string mm/dd/yyyy. I added a dropdown called date_filter with values /=ALL, 2018=2018, 2019=2019, etc with the selected value as "/" or ALL.

In the WHERE sections of the db read have it set to model.reservation_date/LIKE: %{data:date_filter}%, but on the debug screen, it shows where reservation_date LIKE '%%" and doesnt seem to read the date_filter's selected value from the start.

I also need when changing to like 2018, 2019 for it to reload the Table1 view with the new where, but that doesnt seem to work either. Any help?
healyhatman 12 Feb, 2019
Make sure your date field is actually getting sent. I suspect you either don't have it in a form object, or the button you're using to submit the data isn't submitting the right form.

Also you should put a /- after the where condition, for when you want to display everything and skip the condition.

For the reload on change, that's a little more complicated. You can add it in the field event. Put a <div> around the table view like this
<div id="tablewrapper" data-reloadurl="{url:reloadevent}">{view:tablename}</div>

Target the div in the field event with #tablewrapper,

Although I recommend not doing that and just using a button you click to send the form data and view the page again
This topic is locked and no more replies can be posted.