Thread:Semantic-mediawiki.org:Community portal/Guidance on creating an employee form?

Hello,

I'm working on creating a single form that produces an infobox for applicant, freelancer and employee pages.

What I would like to do
These three types of pages share 90% of the same fields -- that's why I opted for a single class instead of 3 different classes. The issue is that the remainder 10% are fields that are exclusive to one or more of the aforementioned types of pages. For example: "Interview Date" should only be displayed in the infobox when the type of page is an applicant. Another example: "Join Date" should only display on employee type of pages (it would be silly to display "Join Date" on an applicant type of page -- as they're in the selection process).

What I have tried
So far I have modified the form to use "show on select". There is a field property called "Type" which allows the user to select between applicant, freelancer and employee. Depending on the selection, certain fields are shown and others are hidden (the 10% I talked about before). The majority of fields are shared by all three types.

The problem is that while these fields hide and show themselves correctly when editing a page with the form, they ALL display regardless on the template, e.g. "Join Date" and "Interview Date" shown up on all three types of pages.

What I need
I've been trying to figure out the ideal way to have the template (which controls the infobox display) to have the same hide and show functionality as the "show on select" option that the form provides.

These are the options I have considered:


 * Add an #ask query to the template which uses FULLPAGENAME and ?Has type to retrieve whether the page is of an applicant, freelancer or employee type. From there use IF statements on each of the fields that should be hidden/displayed according to the value of ?Has type. E.g., if the ?Has value = Applicant then display "Interview Date", else don't display it.
 * Create a template for each type of page to display only the appropriate fields, and then call the template by, again, using an #ask query and IF statements on the person page.

Both options seem messy and I doubt they'd update properly (due to asking for info that is on the same page where the value is set in order to display/hide fields ...). I also have the feeling I'm missing something obvious and it's doing my head in.

My questions

 * Has anyone tried to create a similar type of form in the past?
 * What's the best way of going about this?

Any guidance, tips or pointers in the right direction would be greatly appreciated.

If you need more information or clarification please let me know.

Thank you.