Custom List and Detail view with changed Label text

railer

Member
I am planning a new site which will have a questionaire consisting of about 97 questions. Most of the questions will have a checkbox which, if checked, will signify a "Yes" answer.

Questions:

1. Is it possible to somehow change the the "label" text of the elements in the list and detail view to a statement, instead of a question? How can this be done?

Example:

Form Element Label: Do you provide curriculum for children ages 5 - 10? (checkbox)

If the questions is checked (Yes), then in the List and detail views we want to just display the following "statement" text as a bulleted item:

? Provides a curriculum for children ages 5 -10

Thoughts:

Could we do this using a custom Fabrik template override with the "statement" text programmed into the template? Please suggest other ways this can be accomplished?

2. Is it possible to hide unanswered questions from view and if so, how? I recall that there might be a way to hide them using a CSS style class. Please elaborate on what works and what doesn't work, and if possible, refer me to more information.

Thanks in advance for your suggestions.
 
It seems I might be able to replace the Label (question) in each form element by going to List View Settings/List Settings and entering alternate Label text in the Heading Label field. Does that sound right? And how can I hide the element's data?
 
Yes, you can have a separate label (heading) for the list view.

Hide in which view? Details or list?

-- hugh
 
For the label heading switch, it would be in both List and Detail. Looks like that settings only changes it in the List.
As for hiding, if would be in both List and Detail.

Is the custom template override a good way to do what we want to do since not only do we need to change the questions text into statements, but also display them as bullets in a list.
What other methods can you suggest?
 
There's nothing really built in to do this, you'll need a custom template for the details view. Which is something we'd be happy to help with, but it'd have to be billable work. @mediaateam can talk to you about those requirements.

When you say "hide in the list" .... what happens when you have more than one row, and the answer is 'yes' in one row and 'no' in another? I'm confused as to whether you are trying to hide an entire column, or just blank out the data in a cell.

-- hugh
 
One thing I might be able to bake in, that would make things a bit easier, would be to add a little functionality to the alternate list heading feature. An additional option (YAFO ... Yet Another Option) under the "Heading Label" in the element's list settings, for "Use Heading in Details View". Making it effectively the "read only" heading.

Without that, trying to keep the custom details template in sync with the right alternate headings would be a pain. You'd need to load the element model for every element being rendered, to fetch the list's alternative heading for it. Unless I modified our code to add the alternate heading to the data we hand to the layout for you to use in a layout override.

-- hugh
 
OK, I just committed a quick change, which would allow you to override the label layout:

components/com_fabrik/layouts/element/fabrik-element-label.php

... by copying it to, say ...

components/com_fabrik/views/details/tmpl/your_custom_template/layouts/element/fabrik-element-label.php

... and modifying line 5, which currently does ...

Code:
$labelText = FText::_($d->label);

... to do ...

Code:
$labelText = FText::_($d->altLabel);

That would then use the "list heading" instead of the normal label. The $d->altLabel will be set to the list heading, if specified, or the normal label if not.

This basically does what me adding YAFO to do this would do, without me having to bill for any work to add more options to Fabrik itself.

-- hugh
 
When you say "hide in the list" .... what happens when you have more than one row, and the answer is 'yes' in one row and 'no' in another? I'm confused as to whether you are trying to hide an entire column, or just blank out the data in a cell.

This needs to be fully worked out, but our basic goal is to make all questions into the checkbox type. So to answer your question about "hide in list" any questions where the checkbox was not checked would need to be hidden in both the list and detail views. I should have said above "As for hiding, (it) would be (hidden) in both List and Detail (views)."

The client is concerned that if we just listed questions and the answers, it would make it seem like a negative in that user's profile if, for example, 50 questions out of 97 were answered "No". So we want to find a way to hide all no answers (unanswered) and just focus on the Yes answers they gave. (Again, instead of the question followed by "Yes", we are converting the question into a positive statement. These statements would be a list of all of the "positive" things this user does.

Example:

Form Element Label:
Do you provide curriculum for children ages 5 - 10? [checkbox]

If the questions is checked (Yes), then in the List and detail views we want to just display the following "statement" text as a bulleted item:

? Provides a curriculum for children ages 5 -10

If unchecked, the question would be hidden from view, entirely.
 
Last edited:
@railer We do this on a client site already, just create a custom details template, and write an if statement that checks if it's checked, and if it does, echo the label. Let us know if you need help creating the template, as @cheesegrits mentioned, we can help you with this, but it will be billable work on custom templates. PM me if you do need help.
 
OK, I'm still a little confused about the list view.

In a list view, the element label is at the top of the column. So typically I would expect a binary question like "Do you provide something or other?" to be a YesNo element, not a checkbox, and the list view column to be

Provides something or other
yes
no
no
yes
no
(etc)

(only with ticks and crosses, or your two images of choice, instead of yes/no)

When we display a checkbox result, we display whatever the label(s) of the checkbox option(s) they selected were, as a <ul>.

So I'm still confused about what you mean by "hide in the list". You have multiple rows. Some might be 'yes' some might be 'no'.

-- hugh
 
Hi Hugh -- ah, I misspoke, it wouldn't be shown in the List view at all. Just in the Detail view. Sorry for the confusion Hugh. My bad. I think in this List there would only be two columns shown, Name and Description.
 
@railer We do this on a client site already, just create a custom details template, and write an if statement that checks if it's checked, and if it does, echo the label. Let us know if you need help creating the template, as @cheesegrits mentioned, we can help you with this, but it will be billable work on custom templates. PM me if you do need help.
Hi MediaATeam -- Thanks, this sounds encouraging.

Questions:
1. Would you have to write "if" statements for every single element?
2. Can the echoed label(s) be Hugh's YAFO version which would be a bulleted statement version -- different for each element?
3. In the "if" statement, if the question was not checked, can the entire question/statement be hidden in the Detail view?
4. What if there are other types of elements besides checkboxes?
5. There would be approx 97 questions (elements). How much would that likely cost?
 
Last edited:
Before I answer that ... one thing I'm still puzzled about is element vs checkbox labels.

With these checkboxes, what are you setting the value/label to?

I just want to make sure we've not been talking at cross purposes, and when you are talking about element labels, you do actually mean element labels, not checkbox option labels.

-- hugh
 
With these checkboxes, what are you setting the value/label to? I just want to make sure we've not been talking at cross purposes, and when you are talking about element labels, you do actually mean element labels, not checkbox option labels.
-- hugh

I see your point about element label vs. checkbox label. I forgot that for a checkbox element, you could have multiple checkboxes, each with its own label. If we use the checkbox element type for these questions, each element would only have 1 checkbox. The value for the checkbox would be "Yes", or "1" or whatever it needs to be to be acknowledged as an affirmative answer. We don't want to actually display the answer given, the goal is to display a bulleted statement, but only if the checkbox was checked. Unchecked questions will be completely hidden from view.

I'm mainly looking for suggestions on how best to make this substitution of questions with statements possible. If you think a different element type is more suitable, please let me know.

As long as the user can somehow choose a way to answer the question, so that we can know to display the statement ? that's the goal. Checkboxes seemed like the most obvious option to explore.

BTW, there will be 9 sections of questions, so hypothetically we could use 9 checkbox elements with the main label being more of a section heading, and then setup multiple checkbox values under it (one checkbox for each value), assuming the user could select more than one checkbox. In this scenario each "value" would actually be a separate question. We'd still need to substitute the bulleted statement for each value/question, individually. I mention this merely as an FYI.

Hope this last thing doesn't confuse you. If so, just ignore the above paragraph and focus on whether a checkbox element for each question will allow us to achieve the goal, or if something else needs to be used?
 
Last edited:
Friendly bump. Hoping to get that estimate, either in this thread, or via PM as soon as possible. Thanks
 
Last edited:
Sorry, I dropped Robbie a msg about this, thought she'd checked in with you. I'll rattle her cage.

-- hugh
Thanks Hugh.
I also sent her an email directly, but haven't heard back, unless it went into spam. (She and I met at Joomladay Boston 2015).
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top