Display extra conditional property option depending on another properties value

Hi All,

Is there a way within a class to display an extra property option depending on another properties value?

E.g. A ‘Staff’ class that has normal properties name, etc., and Department. Department being a static list like Admin, Sales, Support… In each department there is a different team, or no team. Sales - Team A or Team B

When creating a new Staff entry after select the Department ‘Sales’, show an other property for salesTeam with Values teamA or teamB. Selecting Admin (if they didn’t have teams) doesn’t show the extra property. Selecting Support show extra property for supportTeam with values teamX, teamY, teamZ.

Realised that the Class Sheet will probably be in charge of this. Something along the lines of (excuse lack of formatting):

#if ($department.empty)
  do nothing
#if ($department == 'support')
  show name and drop-down box for supportTeam

Then I imagine there would be a way to show the new field after selecting an department without needing to save and reload/re-edit.

Can this be done with an html xform <select> box? or is there another/better way to achieve this?

Hello @brickhead92,

If I understand correctly what you wish to do, the Master Detail Tutorial might be an interesting read.

Let me know if that’s off topic :slight_smile:

1 Like

Thanks @mleduc. After a quick read I think might just be what I’m looking for. I’ll have a proper read through and test.

But if I understand correctly, basically making a separate class for the ‘Department Teams’ with the entries

Department A - Team A
Department A - Team B
Department B - Team Y

On the staff entry selecting Department A will show the values Team A, Team B in the Team Property.