Calc placeholder not showing in header on load- only after record is saved

I have a calc element (xxx_subscribers___publishedcalc) that successfully converts an id to text in the form body on load even if the calc element value has not been stored (saved) in the database. Here is the successful calc:


PHP:
$score1 = (int)'{xxx_subscribers___published}';
 
if ($score1 == '0')
return 'Pending';
 
if ($score1 == '1')
return 'Active';
 
if ($score1 == '2')
return 'Expired';
 
if ($score1 == '3')
return 'Cancelled-Refund Pending';

The problem is that the placeholder I put for that same calc element (xxx_subscribers___publishedcalc) in the header of the form only displays a value if the calc element (xxx_subscribers___publishedcalc) value has been stored in the database.

So, when opening/viewing a previously saved record in the form, I see the following:
  • The expected text value in the calc placeholder in the form header AND
  • The expected text value in the calc field in the body of the form
However, when opening/viewing a record that was not previously saved (via Fabrik), I see the following:
  • Nothing in the calc placeholder in the form header BUT
  • The expected text value in the calc field in the body of the form
I have tested all of the combinations of setting options (calc on save, ajax calc, calc on load), but I can not get the placeholder to show unless the form has been saved.

One other problem: I am unable to filter by calc field values that have not been stored.

APPROACH #2:

I tried a different approach, jettisoning the calc element approach and instead turning the main field (xxx_subscribers___published) into a drop down and assigning the appropriate labels to the raw values. I then switched the dropdown to field, changed the element to hidden, and then switched back to dropdown to hide the element from the body of the form. I then added a placeholder for this element (xxx_subscribers___published) to the form header. This fixed the list filter drop down problem, but I can not get the label to show in the form header. Instead only the raw value is returned.

Please help.

Fabrik 3.1 (git one week ago), Joomla 3.2.3
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top