I wish to have two select boxes, the first to select a name from a custom database table and the second to select another name from the same database table but not have the name that was selected in the first select box as an option in the second select box.
I am using migxloopcollection in a select to loop through a custom database of names to select the first name. See below:
<select name="memberid" id="winner1male" onchange="checkMembers()" style="display:none" disabled>
<option value="">Select member ...</option>
[[!migxLoopCollection?
&prefix=`agc_`
&usecustomprefix=`agc_`
&packageName=`honours`
&classname=`Playerdetails`
&selectfields=`id,fullname,gender`
&tpl=`tplOption`
&sortConfig=`[{"sortby":"surname"}]`
&where=`{"gender":"Male"}`
&selected=`[[!+fi.winner1]]`
]]
</select>
I then have a second select using migxloopcollection with a different id, but I do not want the offered selection to include the name from the first select.
<select name="memberid" id="winner2male">style="display:none" disabled>
<option value="">Select member ...</option>
[[!migxLoopCollection?
&prefix=`agc_`
&usecustomprefix=`agc_`
&packageName=`honours`
&classname=`Playerdetails`
&selectfields=`id,fullname,gender`
&tpl=`tplOption`
&sortConfig=`[{"sortby":"surname"}]`
&where=`{"gender":"Male"}`
&selected=`[[!+fi.winner2]]`
]]
</select>
I am able to identify the id of the first selected name and I wanted to exclude it using the &where propery in migxloopcollection.
My tplOption is:
<option value="[[+id]]" data-id="[[+id]]" [[+id:eq=`[[+property.selected]]`:then=` selected="selected"`]]>[[+fullname]]</option>
I appear not to be able to use the &where property as it does not allow a “not equal” in the json data. Can anyone help please.