DMXzone Database Connector PHP Support Product Page

Answered

Search filter using a Form Variable for a checkbox and select menu

Asked 06 Nov 2015 14:00:25
1
has this question
06 Nov 2015 14:00:25 David Woolley posted:
1. How does one set up a filter using a checkbox (Field is either 'y' or 'n')
Not sure what to select for the Form Variable.

2. I've created a dynamic menu according to your video:
www.dmxzone.com/go/22136/creating-a-dynamic-select-list-using-html5-data-bindings

This works fine, but I'm not sure what to use to filter records based on the dropdown selected.
I thought conditions '=' or 'Contains' would do it, but no results shown in the browser. However when I test the source (using either of these conditions) in the dialog box, it retrieves the correct results.

Replies

Replied 09 Nov 2015 14:41:27
09 Nov 2015 14:41:27 David Woolley replied:
I've sorted out the 2nd question about the dynamic menu.
Can't figure out how to filter with a checkbox.
Cheers
Dave
Replied 10 Nov 2015 10:02:30
10 Nov 2015 10:02:30 Teodor Kuduschiev replied:
Hi David,
Just use "contains" filter for both the checkbox and the dropdown.
Replied 10 Nov 2015 10:56:15
10 Nov 2015 10:56:15 David Woolley replied:
Thanks Teodor - that works
Replied 22 Jan 2016 14:27:51
22 Jan 2016 14:27:51 David Woolley replied:
Hi Teodor
How does one NOT select a dynamic item in a select menu and have this as the default, so that ALL records are displayed.

Code example for the field:

<label for="filterOrigin">Filter origin</label>
<select name="filterOrigin" id="filterOrigin" data-binding-repeat-children="{{origin_list.data}}" data-binding-id="filterOrigin">
<option value="{{origin_id}}">{{origin}}</option>
</select>


With the old DW PHP/MySQL server extensions, one could put a static entry at the top, but one can't do this in a repeat region.

For the menu items, there is a child table origins linked to the parent table.

Cheers
Dave
Replied 18 Feb 2016 15:22:18
18 Feb 2016 15:22:18 David Woolley replied:
Essentially I would like to bypass (switch off) the filter so ALL records are displayed.
I've included an extra line by binding:
select.option2.value & select.option2.title

<select name="filterOrigin" id="filterOrigin">
<option value="0" selected="selected">SELECT ALL</option>
<option value="{{origin_id}}" data-binding-repeat="{{origin_list.data}}" data-binding-id="repeat4">{{origin}}</option>
</select>

Not sure how to extend this to include all records - is there a way round this?
Dave
Replied 19 Feb 2016 11:21:28
19 Feb 2016 11:21:28 David Woolley replied:
Please ignore my question above.
One way is to use a checkbox group or multiple choice select list with a SET multiple entry field in the MySQL table.
But not sure how to implement this using the DB Connector. Is this possible?

I know that Dreamweaver Server Behaviors could not handle SET groups, without editing the code.

Dave

Reply to this topic