ConfiForms - Possible to have a dropdown that reduces values for already picked values

Deleted user May 29, 2019

We have a certain setup where every week we publish a list of available time slots. Currently, everyone can edited the page and put their name next to the time slot they want in the list. If someone's name is already next to the time slot, you're not allowed to put your own name there.

 

Now we want to transform this into a form where all the same time slots are available, but as soon as someone has registered their name with a time slot from the list, the time slot should be no longer available in the form for future users (until list were to be cleared). 

 

I was thinking about having a dropdown with all the time slots and remove values as soon as they are picked, but I wouldn't know how to do this.

 

Any ideas or better suggestions?

2 answers

1 accepted

0 votes
Answer accepted
Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 29, 2019

Hi @[deleted] 

You can reduce the number of choices in dropdowns (checkbox/radio group fields) with the help of ConfiForms Field Definition Rules macro and "Apply Filter on Field" action

Here are couple of demos from our wiki

https://wiki.vertuna.com/display/TEST/Using+apply+filter+on+field+rule

https://wiki.vertuna.com/display/TEST/using+apply+filter+on+dependent+smart+dropdowns (when using smart fields)

Deleted user May 29, 2019

Thanks!

0 votes
Martin Niederberger September 29, 2022

Hi @Alex Medved _ConfiForms_ 

I have the exact same challenge with available time slots that should disappear in the dropdown list once a previous user has chosen that option. 

Could you specify how to work with the filter rule in order to achieve that?

Details from my use case: 

fieldname: number (dropdown)

- id1: 1 December
- id2: 2 December
- id3: 3 December

I would now set the "validation rule (dataset)" in the rules macro. But I can't figure out what the specific condition should be so that for example "id1" cannot be chosen by two separate users. 

Many thanks in advance for your help.

Martin

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 29, 2022

Hi @Martin Niederberger 

When exactly something needs to "disappear"? There is a rule to apply on the field to filter out options... https://wiki.vertuna.com/display/CONFIFORMS/ConfiForms+Field+Definition+Rules#ConfiFormsFieldDefinitionRules-ApplyFilteronafield

Not sure also about the part that is refers to "Validation rule (dataset)"... Something like this? https://wiki.vertuna.com/display/CONFIFORMS/Conditional+validation+rules+against+dataset

With condition set to something like

number:[entry.number] AND _count:>1

Alex

Martin Niederberger September 29, 2022

Thanks Alex, it worked with the count:>1 in the condition. 

However it is not very userfriendly, since i have around 20 options in the field "number". And let's assume 19 have already been selected, a user would have to try out a lot of different options to find the one that is still available. 

That's why it would be best if dropdown option id1 would disappear from the list once a user has selected that option in a previous form entry. So that it would no longer appear for any new user.

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 29, 2022

That is why I have asked if your question is about reducing the options or validating the input

Have a look at this rule - https://wiki.vertuna.com/display/CONFIFORMS/ConfiForms+Field+Definition+Rules#ConfiFormsFieldDefinitionRules-ApplyFilterbasedonmatchingcriteria It should be exactly what you are looking to achieve

Alex

Martin Niederberger September 29, 2022

Oh ok! 

What confuses me a little is that in the example you are using two forms. But does the rule "apply filter based on matching criteria" also work on just one form? 

I might have to dig into it some more, but thanks a lot for your support!

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 29, 2022

Probably you are right, and this rule is about 2 forms. I need to check this myself

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 29, 2022

But you can use the rule that was originally suggested in this post

Screenshot 2022-09-29 at 17.58.35.png

!id:[entry.id.queryAndSet(f:@self;*;number.append(,)).split(,).join( AND !id:)]

My form is called "f" and the drodown field is named "number"

Complete setup as page storage format

<ac:structured-macro ac:macro-id="a6f5824e-f2ce-428d-9dbc-52b505ed34c7" ac:name="confiform" ac:schema-version="1">
<ac:parameter ac:name="formName">f</ac:parameter>
<ac:rich-text-body>
<ac:structured-macro ac:macro-id="24cdf4cb-9085-4a06-86e0-172723627b19" ac:name="confiform-entry-register" ac:schema-version="1">
<ac:parameter ac:name="type">Embedded</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p>
<ac:structured-macro ac:macro-id="7ba88198-dc5f-4f35-862f-9f220bc34c48" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="fieldName">number</ac:parameter>
<ac:parameter ac:name="fieldLabel">Number</ac:parameter>
<ac:parameter ac:name="values">false[1=one|2=two|3=three|4=four|5=five|]</ac:parameter>
<ac:parameter ac:name="extras">label;false</ac:parameter>
<ac:parameter ac:name="type">select</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="b7206194-13ad-48f9-b510-77f05b7d33e9" ac:name="confiform-field-definition-rules" ac:schema-version="1">
<ac:parameter ac:name="fieldName">number</ac:parameter>
<ac:parameter ac:name="values">!id:[entry.id.queryAndSet(f:@self;*;number.append(,)).split(,).join( AND !id:)]</ac:parameter>
<ac:parameter ac:name="action">Apply Filter on a field</ac:parameter>
</ac:structured-macro>
</p>
<p>
<br/>
</p>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>

 

Alex

Martin Niederberger September 29, 2022

That's amazing, Alex! Thanks A LOT! 

It now works perfectly, exactly as we wished. 

Martin

Helen Setchell November 11, 2022

Hi Alex

I also need this.

I just copy/pasted your code from above onto a new confluence page (in source code editor) and published.

As a user of the form, I select an item from the pulldown list and Save.

The record is saved, the page refreshes, and the list is then completely empty for the next users, i.e. all the options have been filtered out, not just the one already used.

What am I doing wrong if I've copy/pasted your exact code?

Helen

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 12, 2022

Hard to tell what are you doing wrong... Just did "the same" - copied and pasted the code provided earlier... no modifications

http://recordit.co/ryVwLiIu7F

works as it should

Alex

Helen Setchell November 12, 2022

Thanks Alex - here is what I get doing the same thing https://recordit.co/KXA14OuR6D

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 12, 2022

I can only see a version difference... you are quite behind the current version

Helen Setchell November 12, 2022

Ah ok - I'll ask our admins to upgrade and see if things improve. Thanks again :)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events