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

Retrieve data from picklist

Discussion in 'Community' started by jbadiag, Sep 13, 2018.

  1. jbadiag

    jbadiag Member

    Level: Community
    I know, it's easy but I cannot take the way to extract the list of a picklist elements.
    When I try to use the email form plugin with php file i do:
    PHP:
    <?php
    $dni = $this->data['aj_votacions_pres_part_2018___dni'];
    $opcio= $this->data['aj_votacions_pres_part_2018___com1_raw'];
    $total = $this->data['aj_votacions_pres_part_2018___sumaHidden'];
    echo "has votat amb DNI " . $dni . " les següents opcions<br>" . $opcio ."<br>Els teus projectes votats fan un total de " .$total ."<br><br>Moltes gràcies per votar";
    foreach ($opcio as $value){
        echo "les opcions triades son: " . $value;
    }
    ?>
    But i cannot get nothing. How can I do to get the values of the picklist? Thanks
     
  2. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    Do a ...

    var_dump($this->data);exit;

    ... as the first line, copy and paste the output here, and tell us which is the picklist element.

    -- hugh
     
  3. jbadiag

    jbadiag Member

    Level: Community
    Hi, this its what I get. The picklist Element is ["aj_votacions_pres_part_2018___com1"].
    Thanks

    array(45) { ["aj_votacions_pres_part_2018___id"]=> int(62) ["aj_votacions_pres_part_2018___date_time"]=> string(19) "2018-09-18 14:55:00" ["aj_votacions_pres_part_2018___dni"]=> string(9) "40334641r" ["aj_votacions_pres_part_2018___email"]=> string(20) "comunicacio@teia.cat" ["aj_votacions_pres_part_2018___ip"]=> string(14) "192.168.126.10" ["aj_votacions_pres_part_2018___com1"]=> string(18) "" ["aj_votacions_pres_part_2018___suma"]=> string(5) "39,66" ["aj_votacions_pres_part_2018___sumaHidden"]=> string(9) "390663,00" ["listid"]=> string(2) "41" ["listref"]=> string(2) "41" ["rowid"]=> int(62) ["Itemid"]=> string(4) "3203" ["option"]=> string(10) "com_fabrik" ["task"]=> string(12) "form.process" ["isMambot"]=> string(0) "" ["formid"]=> string(2) "41" ["returntoform"]=> string(1) "0" ["fabrik_referrer"]=> string(0) "" ["fabrik_ajax"]=> string(1) "0" ["package"]=> string(6) "fabrik" ["packageId"]=> string(0) "" ["4ae9a257df07ec470104bf10cd14dd82"]=> string(1) "1" ["format"]=> string(4) "html" ["fabrik_repeat_group"]=> array(3) { [78]=> string(1) "1" [79]=> string(1) "1" [80]=> string(1) "1" } ["currentPage"]=> string(1) "2" ["hiddenElements"]=> string(121) "["aj_votacions_pres_part_2018___id","aj_votacions_pres_part_2018___date_time","aj_votacions_pres_part_2018___sumaHidden"]" ["Submit"]=> string(0) "" ["aj_votacions_pres_part_2018___id_raw"]=> int(62) ["aj_votacions_pres_part_2018___date_time_raw"]=> string(19) "2018-09-18 14:55:00" ["aj_votacions_pres_part_2018___presentacio_raw"]=> NULL ["aj_votacions_pres_part_2018___dni_raw"]=> string(9) "40334641r" ["aj_votacions_pres_part_2018___email_raw"]=> string(20) "comunicacio@teia.cat" ["aj_votacions_pres_part_2018___ip_raw"]=> string(14) "192.168.126.10" ["aj_votacions_pres_part_2018___mode_emploi_raw"]=> NULL ["aj_votacions_pres_part_2018___com1_raw"]=> string(94) "["APLICACIÓ MÒBIL PEL COMERÇ LOCAL “TEIÀ APPORTA!” ","PIPICAN A LA ZONA DE VALLMORA "]" ["aj_votacions_pres_part_2018___suma_raw"]=> string(11) "39.663 €" ["aj_votacions_pres_part_2018___sumaHidden_raw"]=> string(5) "39663" ["__pk_val"]=> string(0) "" ["view"]=> string(4) "form" ["aj_votacions_pres_part_2018___presentacio"]=> NULL ["aj_votacions_pres_part_2018___mode_emploi"]=> NULL ["fabrik_editurl"]=> string(88) "http://www.teia.cat/index.php?option=com_fabrik&view=form&formid=41&rowid=62" ["fabrik_viewurl"]=> string(91) "http://www.teia.cat/index.php?option=com_fabrik&view=details&formid=41&rowid=62" ["fabrik_editlink"]=> string(112) "Modificar" ["fabrik_viewlink"]=> string(111) "Veure" }
     
  4. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    OK, yup, so try ...

    Code (Text):

    $opcio = FabrikWorker::JSONtoData($this->data['aj_votacions_pres_part_2018___com1_raw'], true);
     
    ... to decode the JSON formatted string to an array.

    You could just use json_decode(), but our helper function avoids errors if the data is empty or not valid JSON.

    -- hugh
     
  5. jbadiag

    jbadiag Member

    Level: Community
    PERFECT!!! It works!
    Thanks so much
     

Share This Page