element -> value is label value, not ID value

I have a form which has a database join element. In the form it has a label a description, and an ID as value.
I want to print a value on screen which is from the original element in a different form.
I try to use the content plugin in the following manner, in default_group_labels_none.php :

{fabrik view=element list=2 rowid=<?php $element->value?> element=therapeut_adviezen___Omschrijving show-title=0}

It doesn't work though, and when I do a print_r from $element it's this:

stdClass Object
(
[startRow] => 1
[endRow] => 1
[error] =>
[plugin] => databasejoin
[hidden] =>
[id] => therapeut_p_behandelplan_37_repeat___adviezen_ro_1
[className] => fb_el_therapeut_p_behandelplan_37_repeat___adviezen_ro_1
[containerClass] => plg-databasejoin fb_el_therapeut_p_behandelplan_37_repeat___adviezen_ro_1 fabrikRepeatGroup___therapeut_p_behandelplan_37_repeat___adviezen mode-dropdown
[element] => <div id="therapeut_p_behandelplan_37_repeat___adviezen_ro_1">Progesteoron gebruik premenstruele vrouw</div>
[label_raw] => Adviezen
[label] => <label for="therapeut_p_behandelplan_37_repeat___adviezen_ro_1" class="fabrikLabel control-label" >Adviezen</label>
[errorTag] => <span class="fabrikErrorMessage"></span>
[element_ro] => Progesteoron gebruik premenstruele vrouw
[value] => Array
(
[0] => Progesteoron gebruik premenstruele vrouw
)

[element_raw] => Array
(
[0] => Progesteoron gebruik premenstruele vrouw
)

[labels] => 2
[dlabels] => 2
[tipAbove] =>
[tipBelow] =>
[tipSide] =>
[offset] => 0
[span] => span12
[column] => style="clear:both;width:100%;"
[single] => 1
[fullWidth] =>
)

So in stead of the value which should be the ID number, how it is stored in the database also, I get the label.

Am I in the wrong document, or what am I doing wrong?

Thanks, Hein
 
This is in detail view.

I had an idea, which maybe you guys can make. It is to extend the plugin so that you can choose what to show in detail view from the linked item. This would create a whole lot of extra possibilities to Fabrik.
 
Looks like you aren't seeing the debug output for the element you are trying to use to feed to the plugin - your {fabrik ...} is referencing therapeut_adviezen___Omschrijving, but the debug output is for therapeut_p_behandelplan_37_repeat___adviezen.

But the basic issue is really that outputting the {fabrik ...} plugin from within that template is self defeating, if you are just tyring to show that element on this form is a different way. That template is already doing all the formatting for that element.

The "raw" value should be in $element->element_raw, and for a join element, that'll be an array. If the join is a single value type (dropdown, radio), it'll just have one entry in the array, so $element->element_raw[0] should contain your value.

If you provide a little more detail on what you are trying to do, I can probably be of more help.

-- hugh
 
Hi Hugh,

What I try to do is as follows: when we make a therapy for a person it will contain specific pre-programmed advices. These are chosen with a database join element, drop-down, and repeat-group. In the detail view of this therapy I don't want to just show the 'name' of the advice, but the full advice.

I will try what you say above and get back to you.
 
Have you tried using the 'description field' under the advanced options for your join element?

Perhpas not a perfect solution, but may work for you, without having to customize anything. You can use the CONCAT() format described in the tooltip if you need to use data from multiple fields in the descriptive text.

-- hugh
 
That's great! Yes, that's exactly what I needed! Saves a ton of work!

Now, one more thing. It doesn't show in the PDF view. Where should I start?
 
I took a copy from the bootstrap template. Also when I try the original bootstrap or the bootstrap tabs template it doesn't show those description values.
 
I can replicate it, but I honestly don't know why it's not showing. It's straight forward HTML markup, nothing funky.

I'm playing around with removing the classes we put on those divs to see if that's the issue.

-- hugh
 
OK, let me know. I'm pretty sure that should fix it, we had a bug in our markup / CSS, where the active description had an empty "display:" style attribute. Browsers default that to something visible, but the PDF conversion in DOMPDF was getting confused, and deciding to use "display: none" instead.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top