DMXzone App Connect Support Product Page


Checkbox to filter records if a certain field has content

Asked 21 Nov 2018 10:24:28
has this question
21 Nov 2018 10:24:28 David Woolley posted:
I'm converting a site from HTML5 Data Bindings to App Connect.

I use a checkbox to filter records if a certain field has content. In this example below, the field is 'presentation' and I need to show only those records where 'presentation' exists. This field contains a url always starting with https.

<input name="filtervm" type="checkbox" id="filtervm" value="1">
So when the checkbox is ticked, the filtered results should display.

I had it working nicely using the filter in Data View like so:

filtervm.checked.then(presentation, filtvm.value==0)
(Similar to a ternary operator)

but Data View is too slow for my data set of 4000 records, so I've had to go back to using a filter in a paged query in Server Connect

Server Action:

Globals > {{$_GET.filtervm}}

Paged query filter:
cases.presentation contains "https"
with condition: {{$_GET.filtervm==1}}

(presentation field always starts with https )

This works well with the existing page using HTML5 Data Bindings - tick the checkbox, then the filtered records show immediately.

I've tried setting this up with App Connect using the same Server Action above, but it only displays the filtered results, with the checkbox unchecked or checked. I must be missing a step in App Connect.

By the way it works perfectly if a text search field is used instead of a checkbox, so the issue must be related to the checkbox input.


Replied 06 Dec 2018 11:07:52
06 Dec 2018 11:07:52 David Woolley replied:
I realize now that one needs a parent dmx-checkbox-group for a checkbox to work.
Here is the code:

<form id="vmform" role="form">
<div class="form-group">
<div class="checkbox-group" id="filtergroup" is="dmx-checkbox-group" dmx-bind:value="vmform.filtergroup.filtervm.value">
<label for="filtervm">Filter for VM:</label>
<input name="filtervm" type="checkbox" id="filtervm" value="1">

However this shows ALL records, and the checkbox is always displayed checked.
I've tried without the form tags as well - no difference.

Chrome Dev Tools shows an extra is=dmx-checkbox in the <input> line.

It would be so useful if DMXzone had a video on how to filter with App Connect using a Server Connect filtered query as explained in the previous post.

I'm going round in circles trying to sort this out ...

Cheers Dave
Replied 06 Dec 2018 11:27:08
06 Dec 2018 11:27:08 Teodor Kuduschiev replied:
Please check the following article:
It explains how to do it in Wappler, but it is the same in DW.
Replied 06 Dec 2018 14:07:49
06 Dec 2018 14:07:49 David Woolley replied:
Thanks Teodor - I figured it out for the case using ONE filter.
An array is not necessary for ONE filter - just use $_GET.filtervm

The key here is to bind the Input Parameter in the Server Connect component to the checkbox group value: dmx-param:filtervm="vmform.filtergroup.value"

What should the checkbox group value be set to?
  • dmx-bind:value="value[0].$value"
  • dmx-bind:value="value"
  • No value set

It doesn't make any difference, so I suppose this should be left blank - they all filter correctly.

It would be nice for us Dreamweaver users to have a video tutorial on checkbox filtering - it's not trivial.
I like the code view displays in your later videos - very informative.


Replied 06 Dec 2018 14:12:21
06 Dec 2018 14:12:21 Teodor Kuduschiev replied:
You should not set a value to the checkbox group.
This is only needed for detail pages/update record pages, where you want to have specific checkboxes checked depending on the returned values.
Replied 06 Dec 2018 14:14:50
06 Dec 2018 14:14:50 David Woolley replied:
Thanks Teodor - useful to know.
Cheers Dave

Reply to this topic