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?
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)
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Probably you are right, and this rule is about 2 forms. I need to check this myself
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
But you can use the rule that was originally suggested in this post
!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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That's amazing, Alex! Thanks A LOT!
It now works perfectly, exactly as we wished.
Martin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hard to tell what are you doing wrong... Just did "the same" - copied and pasted the code provided earlier... no modifications
works as it should
Alex
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I can only see a version difference... you are quite behind the current version
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ah ok - I'll ask our admins to upgrade and see if things improve. Thanks again :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.