HI,
In our vertebrate collection, some preparations have subpreparations. In total, there are too many subpreparations, having them all in a single picklist would be cumbersome. Instead, I am using a conditional panel to show different picklists depending on the value of the prepType field. I am using the combobox attribute picklist=“picklist-name”. For example:
<cell type="field" id="7" name="prepType" uitype="combobox" picklist="PrepType"/>
<cell type="panel" id="prepitempanel" name="prepitempanel" colspan="3" coldef="1px,0px,2px">
<rows/>
<rows condition="prepType=Egg">
<row>
<cell type="label" labelfor="itemEGG"/>
<cell type="field" id="itemEGG" name="text1" uitype="combobox" picklist="itemsEGG"/>
</row>
</rows>
<rows condition="prepType=Miscallaneous">
<row>
<cell type="label" labelfor="itemVAR"/>
<cell type="field" id="itemVAR" name="text1" uitype="combobox" picklist="itemsVAR"/>
</row>
</rows>
I have 2 questions about using a condition picklist like this.
-
I have always defined the picklists for a field in the Schema Config but in this case, the picklist in defined only as an attribute of the combobox field. Is there a difference in how Specify treats picklists defined these 2 ways? I am wondering if using only the attribute of the combobox field will cause troubles for some reason.
-
One potential source of error is that someone changes the prepType and forgets to also change the subpreparation. If the subpreparation picklist is defined as readonly, then the combobox will show that the value is invalid, which is helpful, but the form can still be saved:
Is there a way to make the “invalid value” message a bit more ovbious? Or give a message before saving the form about the wrong picklist value?
Cheers,
Soraya
Hi Soraya,
Thanks for reaching out!
For your first question:
It is best to associate a pick list with a field by both attributing the picklist name in the designated field’s cell in the XML and assigning the field to its designated pick list in Schema Config. You can get away with only assigning the pick list in Schema Config and leaving the field with just uitype="combobox"
in the XML, however, assigning more than one picklist to a single field in the view definition will not reflect correctly on the forms without the appropriate schema configuration.
In your case, you’ll want to use a different text field for each subpreparation pick list needed; i.e., text1 for itemEGG pick list, text2 for itemVAR pick list, and so on.
For the second question:
There is not a way to add save prevention for this kind of error in the database at this time. If you’re interested in having this implemented, please add a post to the New Feature Requests category here on the forum!
Hi @bronwynsccwy, thanks for your reply.
My first approach was to use different text fields for each subpreparation, each with a different picklist, but the subpreparation field is in a conditional panel and it does not show in the grid view, which I usually prefer.
So, to make the subpreparation visible as a grid I created a new grid viewdef in which the subpreparation is not in a conditional panel and is a readonly text field. If each subpreparation is in a different text field, then I would have to create many separate viewdef for the grid view of each subpreparation, I guess.
That’s a bit too complicated, so, I put the subpreparation in a single combobox field and change the picklist in the attribute of the field, in a conditional panel, of course.
It works, it’s just far from ideal. I could same me the trouble by showing only the form view, but I think grids are better for preparations.
Cheers,
Soraya