1. We suggest you do NOT update to Joomla 3.8.10 until we can resolve an issue it causes with caching in Fabrik. If you do install it, you'll need to disable Joomla's "System Cache" in the global System settings.
  2. Apologies for the recent server outage, a planned migration by our host provider to a new location turned into a bit of a nightmare.

How to display the value instead of the label?

Discussion in 'Community' started by railer, Jan 12, 2018.

  1. railer

    railer Member

    Level: Community
    I have form with a number of radiobutton elements. The labels are Yes, and No.
    In the Value field for the Yes option I have a short sentence of text. In the No option, it is just No.

    When I view he Detail page of the record, it is displaying the "Yes" label. How to I get it to display the short text sentence?

    Thanks!
     
  2. Sophist

    Sophist Well-Known Member

    Level: Community
    Swap the values and labels.

    The labels are what are displayed, the values are what is stored in the database.
     
  3. railer

    railer Member

    Level: Community
    Thanks for your reply Sophist. The problem is that this is a Radiobuttom element, whose labels are "Yes/No". Whereas the value is a text sentence, (correctly stored in the database) wouldn't work in a Yes/No button. Any other ideas? I'm assuming I need code to swap them, yes?
     
  4. Sophist

    Sophist Well-Known Member

    Level: Community
  5. railer

    railer Member

    Level: Community
    Yes, I know. They are radio button elements. In the form, I want the label to say "Yes", but in the Detail view, I want the value to display, but it is saying "Yes" not what was stored in the database. To explain further, here is an example:

    Question: Do you offer programs for children at your institution?

    Radiobutton configuration:

    Value: Offers programs for children Label: Yes
    Value: No Label: No

    ------------
    The full feature of this form is: Make the detail page into more of a report in prose, rather than a display of questions and answers.

    So this particular question would look like this in the Detail view:

    ? Offers programs for children.

    We would hide the question, entirely.
     
  6. Sophist

    Sophist Well-Known Member

    Level: Community
    You cannot do what you want directly - the label is what is displayed in both form and views.

    Easiest would be to use groups - set the group with the radio buttons to Form only, and make a matching group with calc fields which show the raw value that is shown in Details view only.
     
  7. revolt73

    revolt73 New Member

    Level: Community
    Hi
    I have the same need to display in the list and detail view, the value of the radio button field. Can you explain to me how to do step by step?
    Thanks for the support
     
  8. Sophist

    Sophist Well-Known Member

    Level: Community
  9. revolt73

    revolt73 New Member

    Level: Community
    Yes i read the wiki, "Equally this label is shown in the table view rather than the recorded value (which is stored in the database table itself)". this is the question. I would like the value to be shown instead of the label after submited the form, both in the list and in the detail view of the record.
     
  10. Sophist

    Sophist Well-Known Member

    Level: Community
    Then see above for the solution. (To show a calc field with the value in list / details.)
     
  11. revolt73

    revolt73 New Member

    Level: Community
    Sorry but the value not a numeric but a text string for example (the first label is "no" and value is no, the second label is "yes" and the value is "hello world")...... above solution is the same form my situation?
     
  12. Sophist

    Sophist Well-Known Member

    Level: Community
    So? Calc is not limited to numbers.
     
  13. revolt73

    revolt73 New Member

    Level: Community
    Thanks for the support
     
  14. Sophist

    Sophist Well-Known Member

    Level: Community
    Did it work?
     
  15. revolt73

    revolt73 New Member

    Level: Community
    Hi
    I understood the solution, but technically I do not know how to apply it.
     
  16. Sophist

    Sophist Well-Known Member

    Level: Community
    The php for the calc is:
    Code (Text):
    return '{databasejoin_placeholder_raw}';
    where {databasejoin_placeholder} is the placeholder shown in the elements list with "_raw" appended to get the value rather than the label.

    You can decide whether you want the databasejoin or the calc or neither shown in the list in the elements' List settings.

    To display the label in form but not details, set the Group setting to "Form only".

    Put the calc field in a different group which is "Details only".
     

Share This Page