Using filter based on criteria rule for Smart Dropdowns
Asked by Michael K?ng:

Hello,

I am trying to set up a complex form and I need the option to filter "Smart Dropdown" fields by matching criteria on another form. I saw the [existing example](https://wiki.vertuna.com/display/CONFIFORMS/Using+filter+based+on+criteria+rule) but I struggle anyway.

In the example below, I trying to filter the field "choice" in form f2 by the field "options" in form1. I just want to see the related fields "text" in form f1.

Maybe you can give me a hint?

++Example:++

\<p class="auto-cursor-target"\>  
\<br/\>  
\</p\>  
\<ac:structured-macro ac:macro-id="8dd1a31e-842c-452f-a403-da2b75109fd1" ac:name="confiform" ac:schema-version="1"\>  
\<ac:parameter ac:name="formName"\>form1\</ac:parameter\>  
\<ac:rich-text-body\>  
\<p class="auto-cursor-target"\>  
\<br/\>  
\</p\>  
\<ac:structured-macro ac:macro-id="50cac5de-96aa-4850-8431-4c115969f2f3" ac:name="confiform-entry-register" ac:schema-version="1"\>  
\<ac:parameter ac:name="formName"\>form1\</ac:parameter\>  
\<ac:parameter ac:name="registrationButtonLabel"\>Register f1\</ac:parameter\>  
\<ac:parameter ac:name="atlassian-macro-output-type"\>INLINE\</ac:parameter\>  
\<ac:rich-text-body\>  
\<p\>  
\<br/\>  
\</p\>  
\</ac:rich-text-body\>  
\</ac:structured-macro\>  
\<p\>  
\<ac:structured-macro ac:macro-id="42e3804d-4e0b-4a59-9f19-946512d3af19" ac:name="confiform-field-definition" ac:schema-version="1"\>  
\<ac:parameter ac:name="fieldName"\>options\</ac:parameter\>  
\<ac:parameter ac:name="fieldLabel"\>Options\</ac:parameter\>  
\<ac:parameter ac:name="type"\>text\</ac:parameter\>  
\</ac:structured-macro\>  
\</p\>  
\<p\>  
\<ac:structured-macro ac:macro-id="8717d075-6fc7-4430-87f8-3a34a0c7a8cd" ac:name="confiform-field-definition" ac:schema-version="1"\>  
\<ac:parameter ac:name="fieldName"\>text\</ac:parameter\>  
\<ac:parameter ac:name="fieldLabel"\>Text\</ac:parameter\>  
\<ac:parameter ac:name="type"\>text\</ac:parameter\>  
\</ac:structured-macro\>  
\</p\>  
\</ac:rich-text-body\>  
\</ac:structured-macro\>  
\<h2\>f1 items\</h2\>  
\<ac:structured-macro ac:macro-id="f19ae23e-f351-4c5d-a2d8-c667737c64af" ac:name="confiform-table" ac:schema-version="1"\>  
\<ac:parameter ac:name="formName"\>form1\</ac:parameter\>  
\<ac:rich-text-body\>  
\<p\>  
\<br/\>  
\</p\>  
\</ac:rich-text-body\>  
\</ac:structured-macro\>  
\<p\>  
\<br/\>  
\</p\>  
\<h2\>form 2 with options filtered against registered ones\</h2\>  
\<ac:structured-macro ac:macro-id="e9cc4c25-7457-4304-b33b-4370d73f20a8" ac:name="confiform" ac:schema-version="1"\>  
\<ac:parameter ac:name="formName"\>form2\</ac:parameter\>  
\<ac:rich-text-body\>  
\<p class="auto-cursor-target"\>  
\<br/\>  
\</p\>  
\<ac:structured-macro ac:macro-id="aac4b0a1-1bf9-4d0a-91e1-ab36293ebfe9" ac:name="confiform-entry-register" ac:schema-version="1"\>  
\<ac:parameter ac:name="formName"\>form2\</ac:parameter\>  
\<ac:parameter ac:name="embedded"\>true\</ac:parameter\>  
\<ac:parameter ac:name="atlassian-macro-output-type"\>INLINE\</ac:parameter\>  
\<ac:rich-text-body\>  
\<p\>  
\<br/\>  
\</p\>  
\</ac:rich-text-body\>  
\</ac:structured-macro\>  
\<p\>  
\<ac:structured-macro ac:macro-id="31ff32eb-1ddd-48bb-b2a3-1efffb29bc7c" ac:name="confiform-field-definition" ac:schema-version="1"\>  
\<ac:parameter ac:name="fieldName"\>choice\</ac:parameter\>  
\<ac:parameter ac:name="fieldLabel"\>Choice\</ac:parameter\>  
\<ac:parameter ac:name="values"\>\[828378869\|form1\|options\|true\|\|\]\</ac:parameter\>  
\<ac:parameter ac:name="type"\>smartselect2\</ac:parameter\>  
\</ac:structured-macro\>  
\</p\>  
\<p\>  
\<ac:structured-macro ac:macro-id="f15c989f-6a26-4477-90cc-7fbfeee38815" ac:name="confiform-field-definition-rules" ac:schema-version="1"\>  
\<ac:parameter ac:name="condition"\>\*\</ac:parameter\>  
\<ac:parameter ac:name="fieldName"\>choice\</ac:parameter\>  
\<ac:parameter ac:name="values"\>options:Test1\</ac:parameter\>  
\<ac:parameter ac:name="action"\>Apply Filter based on matching criteria\</ac:parameter\>  
\<ac:parameter ac:name="values2"\>f1:this\</ac:parameter\>  
\<ac:parameter ac:name="values3"\>options\</ac:parameter\>  
\</ac:structured-macro\>  
\</p\>  
\</ac:rich-text-body\>  
\</ac:structured-macro\>  
\<h2\>f2 items\</h2\>  
\<ac:structured-macro ac:macro-id="fdb4dfe7-07fe-4331-bf94-ac6912a87f48" ac:name="confiform-table" ac:schema-version="1"\>  
\<ac:parameter ac:name="formName"\>form2\</ac:parameter\>  
\<ac:rich-text-body\>  
\<p\>  
\<br/\>  
\</p\>  
\</ac:rich-text-body\>  
\</ac:structured-macro\>  
\<p class="auto-cursor-target"\>  
\<br/\>  
\</p\>


Answers:
author: Alex Medved _ConfiForms_
body: Hi

Sorry, I dont quite understand this

```

I trying to filter the field "choice" in form f2 by the field "options" in form1. I just want to see the related fields "text" in form f1
```

could you explain? Field choice is already set up to get options from form1.. how these options have to be filtered?

And in the configuration you have pasted you have forms: form1 and form2, but rules are applied on the form **f1**...

```
f1:this
```

Alex

comments: author: Alex Medved _ConfiForms_
body: I am unsure what your requirements are and what you want to achieve, but I think the rule needs to be changed to

```
<ac:structured-macro ac:macro-id="a9ffcf13-4bbd-4509-9f68-338457988a95" ac:name="confiform-field-definition-rules" ac:schema-version="1">
<ac:parameter ac:name="condition">*</ac:parameter>
<ac:parameter ac:name="fieldName">choice</ac:parameter>
<ac:parameter ac:name="values">options:Test1</ac:parameter>
<ac:parameter ac:name="action">Apply Filter based on matching criteria</ac:parameter>
<ac:parameter ac:name="values2">form1:@self</ac:parameter>
<ac:parameter ac:name="values3">id</ac:parameter>
</ac:structured-macro>
```


author: Michael K?ng
body: The correct answer from you by this bad explanation from me is Godlike! Thank you so much! :)


Tags: cloud

confiforms

confluence-cloud