1. Fabrik 3.9 has been released. If you have updated Joomla to 3.9, this is a required update.
    Dismiss Notice

Display element dinamic update [SOLVED]

Discussion in 'Community' started by Puma173, Jun 28, 2020.

  1. Puma173

    Puma173 New Member

    Level: Community
    Good morning everyone.

    First of all, I have to thank the authors of these great extensions and the community members for all the work done.

    I have a question.
    I have a form to collect the visits to my plant.
    One or more policies (security, data, ...) are applicable for all the visitors of the plant.
    Policies and Plants have a relation table (N-M).
    On the "visits" form I insert two fields:
    1. "plant_id" (database join with the "plants" table)
    2. "policies" (display element)
    I need to display the plant-related policy/ies (id or title) in the "policies" element. The policies change based on the plant selection.
    I tried to do this with a PHP plugin but I'm in trouble.
     
  2. juuser

    juuser Active Member

    Level: Community
    Use calc element for policies and in the calc element settings use "plant" dbjoin element as "ajax observe field". So the policy will update when plant is selected.

    Or you can have another field in plants table where you add the policy. And then use that field as "comment" field in dbjoin element settings.
     
  3. Puma173

    Puma173 New Member

    Level: Community
    Tks a lot for your reply.
    I followed your suggestion but I'm having some issues.
    Where am I wrong?
    I'm a newbie...sorry for my poor knowledge.
     

    Attached Files:

    • 1.png
      1.png
      File size:
      52.9 KB
      Views:
      25
    • 2.png
      2.png
      File size:
      56.4 KB
      Views:
      25
  4. juuser

    juuser Active Member

    Level: Community
    Not sure, but try to replace $plantId = '{visits___plant_id}; with $plantId = '{visits___plant_id_raw};

    Do you get expected results to your query in phpMyAdmin if you replace '$plantId' with some existing fixed value?
     
  5. Puma173

    Puma173 New Member

    Level: Community
    First of all, thanks a lot for your collaboration. The calc element was the right suggestion. The issues were to the use of a deprecated db connection (I'm using 7.3 PHP version). So it's necessary to adopt these PHP references: http://fabrikar.com/forums/index.php?wiki/calculation-element/
     
    juuser likes this.
  6. troester

    troester Well-Known Member Staff Member

    Level: Community
    Which part is deprecated in the WIKI?
     
  7. Puma173

    Puma173 New Member

    Level: Community
    $db =& JFactory::GetDbo();
     
  8. troester

    troester Well-Known Member Staff Member

    Level: Community
    I can't see a '& JFactory::' there.
     

Share This Page