[TYPO3-dev] Get record ID from a choosen item in a flexform select field

Johannes C. Laxander typo3 at laxander.net
Sat Nov 23 16:37:41 CET 2013


this two fields are defined in a flexform:

<field1>
  <TCEforms>
    <label>Select-Field-1:</label>
    <onChange>reload</onChange>
    <config>
      <type>select</type>
      <items type="array">
        <numIndex index="0" type="array">
          <numIndex index="0">All items</numIndex>
          <numIndex index="1">0</numIndex>
        </numIndex>
      </items>
      <foreign_table>tx_extension_domain_model_table1</foreign_table>
      <foreign_table_where>ORDER BY name</foreign_table_where>
      <minitems>0</minitems>
      <maxitems>1</maxitems>
    </config>
  </TCEforms>
</field1>

<field2>
  <TCEforms>
    <label>Select-Field-2:</label>
		<displayCond>FIELD:field1:REQ:true</displayCond>
    <config>
      <type>select</type>
      <items type="array">
        <numIndex index="0" type="array">
          <numIndex index="0">All items</numIndex>
          <numIndex index="1">0</numIndex>
        </numIndex>
      </items>
      <foreign_table>tx_extension_domain_model_table2</foreign_table>
      <foreign_table_where>AND (table1_assignment = ###record-ID-of-selected-item-from-field1### ORDER BY name</foreign_table_where>
      <minitems>0</minitems>
      <maxitems>1</maxitems>
    </config>
  </TCEforms>
</field2>

Choose a item in select field1, the record id from this item will be set as filter criteria into the foreign_table_where tag of select field2, see above.

How can I get the record ID from the first select field to put it into <foreign_table_where> instead of ###field1### ??? Is there a way to do this?

Johannes.




More information about the TYPO3-dev mailing list