How to retrieve only some data from the List Field

Dear all,
On my forms, one of them has a List Field.
I’ve managed to display it on my php template in the following way and working good:

{list:18} or <?php echo $form_data['field'][18]; ?>

My question is I want to retrieve some data from the List Field.
As in the image below, I want to retrieve only the data value as in the example image that I circled in red.

I’ve tried some of the code below but it doesn’t work.

{list:18:1} or <?php echo $form_data['field'][18][1]; ?>

Please help.

Hello. Which hook or filter are you using to display your data? If you are working in a template file, you won’t have access to Gravity Forms variables like $form_data but you can use GFAPI functions from here in you template file:

Can you provide all the code you are using please?

Hi Chris,
Below is the template I use, the list field is at the very end of the code.

<?php 

/**
 * Template Name: SPB
 * Version: 1.0
 */

/* Prevent direct access to the template (always good to include this) */
if ( ! class_exists( 'GFForms' ) ) {
    return;
}

?>

<!-- Any PDF CSS styles can be placed in the style tag below -->
<style>
@page {
        header: html_myHeader;
        footer: html_myFooter;
}

table.header {
    	border:none !important;
		vertical-align: bottom; 
    	font-family: arial; 
    	color: #000000;
    	width: 100%;
}

.footer {
    	text-align: center;
		font-size: 11px;
}

ul {
    float:left;
    clear:right;
    padding:5px;
}

.noBorder {
    border:none !important;
	font-size: 16px;
	font-family: Arial;
	text-align: left;
}

.noBordera {
    border:none !important;
}

.noBorders {
    border:none !important;
	font-size: 11px;
	font-family: Arial;
	text-align: right;
}

.noBorderz {
    border:none !important;
	font-size: 11px;
	font-family: Arial;
	text-align: left;
}

.noBorderx {
    border:none !important;
	font-size: 11px;
	font-family: Arial;
	text-align: center;
}

th {
  border:1px solid black;
  border-collapse:collapse;
  font-size: 12px;
}

tr {
  border:1px solid black;
  border-collapse:collapse;
}

table {
  border:1px solid black;
  border-collapse:collapse;
}

td {
  border:1px solid black;
  font-family:Arial;
  font-size:12px;
  text-align: center;
}

.style1 {
	font-size: 18px;
	font-family: Arial;
	text-align: center;
	font-weight: bold;
	text-decoration: underline;
}

.style2 {
	font-size: 12px;
	font-family: Arial;
	text-align: center;
	font-weight: bold;
}

.style3 {
	font-size: 16px;
	font-family: Arial;
	text-align: left;
}

.style4 {
	font-size: 11px;
	font-family: Arial;
	text-align: left;
}

.style5 {
	font-size: 12px;
	font-family: Arial;
	text-align: center;
	font-weight: bold;
}

</style>
<!-- The PDF content should be placed in here -->
<htmlpageheader name="myHeader">
<table style="border-collapse: collapse; border: none;">
    <tr class="noBorder">
      <td width="199" class="noBorder"></td>
      <td width="12" class="noBorder"></td>
      <td width="285" class="noBorder"></td>
      <td width="10" class="noBorder"></td>
      <td width="172" class="noBorder"></td>
      <td width="12" class="noBorder"></td>
      <td width="277" class="noBorder"></td>
  </tr>
    <tr class="noBorder">
      <td class="noBorder"></td>
      <td class="noBorder"></td>
      <td class="noBorder"></td>
      <td class="noBorder"></td>
      <td class="noBorder">Ekspedisi</td>
      <td class="noBorder">:</td>
      <td class="noBorder">{Ekspedisi:14}</td>
    </tr>
    <tr class="noBorder">
      <td class="noBorder">Kepala Cabang/Project</td>
      <td class="noBorder">:</td>
      <td class="noBorder">{Kepala Cabang / Project:11}</td>
      <td class="noBorder"></td>
      <td class="noBorder">Nomer Resi</td>
      <td class="noBorder">:</td>
      <td class="noBorder">{Nomer Resi:15}</td>
    </tr>
    <tr class="noBorder">
      <td class="noBorder">PIC Gudang</td>
      <td class="noBorder">:</td>
      <td class="noBorder">{PIC Gudang:12}</td>
      <td class="noBorder"></td>
      <td class="noBorder">Moda Transportasi</td>
      <td class="noBorder">:</td>
      <td class="noBorder">{Moda Transportasi:16}</td>
    </tr>
    <tr class="noBorder">
      <td class="noBorder">No. HP/Telp</td>
      <td class="noBorder">:</td>
      <td class="noBorder">{No. HP/Telp:13}</td>
      <td class="noBorder"></td>
      <td class="noBorder">No. Kendaraan</td>
      <td class="noBorder">:</td>
      <td class="noBorder">{No. Kendaraan:17}</td>
    </tr>
</table>
</htmlpageheader>
<htmlpagefooter name="myFooter">
<table width="100%" style="border-collapse: collapse; border: none;">
  <tr class="noBorderx">
    <td class="noBorderx">Dicheck oleh,</td>
    <td class="noBorderx">Dikirim oleh,</td>
    <td class="noBorderx">Diterima oleh,</td>
  </tr>
  <tr class="noBorderx">
    <td height="45" class="noBorderx">&nbsp;</td>
    <td class="noBorderx">&nbsp;</td>
    <td class="noBorderx">&nbsp;</td>
  </tr>
  <tr class="noBorderx">
    <td class="noBorderx">___________________________</td>
    <td class="noBorderx">___________________________</td>
    <td class="noBorderx">___________________________</td>
  </tr>
  <tr class="noBorderx">
    <td class="noBorderx">Section / Unit Head</td>
    <td class="noBorderx">Ekspedisi</td>
    <td class="noBorderx">Cabang / Project</td>
  </tr>
</table>
<p class="style4">*) KOLOM KETERANGAN BERISI INFORMASI</p>
<br >
<table style="border-collapse: collapse; border: none;">
  <tr class="noBorderz">
    <td width="60" class="noBorderz">Lembar 1</td>
    <td width="12" class="noBorderz">:</td>
    <td width="100" class="noBorderz">Warehouse</td>
  </tr>
  <tr class="noBorderz">
    <td class="noBorderz">Lembar 2</td>
    <td class="noBorderz">:</td>
    <td class="noBorderz">Ekspedisi</td>
  </tr>
  <tr class="noBorderz">
    <td class="noBorderz">Lembar 3</td>
    <td class="noBorderz">:</td>
    <td class="noBorderz">Security</td>
  </tr>
  <tr class="noBorder">
    <td class="noBorderz">Lembar 4</td>
    <td class="noBorderz">:</td>
    <td class="noBorderz">Cabang / Project</td>
  </tr>
</table>

    <div class="footer">
    	Page: {PAGENO}/{nbpg}
    </div>
</htmlpagefooter>
{list:18}

Below is a detailed view of the data.

[18.List] => 

					
List

		
ORDER SHEET / URAIAN BARANG	 REFERENSI 	 COLI 	 BERAT KOTOR (KG) 	 KUBIKASI (M3) 	 KETERANGAN 
1	1	1	1		
2	2	2	1		
3	3	2	1		
4	4	3	1		

		

            [18] => 

					
List

		
ORDER SHEET / URAIAN BARANG	 REFERENSI 	 COLI 	 BERAT KOTOR (KG) 	 KUBIKASI (M3) 	 KETERANGAN 
1	1	1	1		
2	2	2	1		
3	3	2	1		
4	4	3	1		

		

            [List] => 

					
List

		
ORDER SHEET / URAIAN BARANG	 REFERENSI 	 COLI 	 BERAT KOTOR (KG) 	 KUBIKASI (M3) 	 KETERANGAN 
1	1	1	1		
2	2	2	1		
3	3	2	1		
4	4	3	1		

		

        
    [list] => Array
        (
            [18] => Array
                (
                    [0] => Array
                        (
                            [ORDER SHEET / URAIAN BARANG] => 1
                            [ REFERENSI ] => 1
                            [ COLI ] => 1
                            [ BERAT KOTOR (KG) ] => 1
                            [ KUBIKASI (M3) ] => 
                            [ KETERANGAN ] => 
                        )

                    [1] => Array
                        (
                            [ORDER SHEET / URAIAN BARANG] => 2
                            [ REFERENSI ] => 2
                            [ COLI ] => 2
                            [ BERAT KOTOR (KG) ] => 1
                            [ KUBIKASI (M3) ] => 
                            [ KETERANGAN ] => 
                        )

                    [2] => Array
                        (
                            [ORDER SHEET / URAIAN BARANG] => 3
                            [ REFERENSI ] => 3
                            [ COLI ] => 2
                            [ BERAT KOTOR (KG) ] => 1
                            [ KUBIKASI (M3) ] => 
                            [ KETERANGAN ] => 
                        )

                    [3] => Array
                        (
                            [ORDER SHEET / URAIAN BARANG] => 4
                            [ REFERENSI ] => 4
                            [ COLI ] => 3
                            [ BERAT KOTOR (KG) ] => 1
                            [ KUBIKASI (M3) ] => 
                            [ KETERANGAN ] => 
                        )

                )

        )

additional information that the List Field id is number 18 {List:18}

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.