[TYPO3-english] Using object properties of a list of existing objects options in a form.select viewhelper

christian ewigfrost christian-kulozik at gmx.net
Mon Oct 16 09:08:43 CEST 2017


Before i start describing the Problem: I'm pretty new to Typo3 and Extension developement for it (it's basically my first Extension and the first time i'm working with Typo3), so don't be to hard on me.

Currently im developing an extension that lets the user create objects of the class "Appliance" with the help of a form. Defining the properties through textfields isn't the big problem here, BUT: I want to also implement a drop down box via select in the form. The user should be able to choose from objects (or rather a specific property of These objects - "Kundeuid") of another class ("Kunde") that is of cause also part of the extension. Creating the "Kunde" objects isn't part of the extension. They are created in the backend and stored in a folder (of cause). I want to use these objects in the form.select in the FormFields.html partial as options. But i cant wrap my head around the functionality here. I think my problem is that i don't seem to understand the connection between the controller(s) and the specific templates and partials. The functionality seems to resemble the binding between XAML and C# in WPF (which were my previous projects) but i still can't figure it out.

Here the specific partial:

<html xmlns:f......" data-namespace-typo3-fluid="true">
<label for="kundeuid">
	<f:translate key="tx_icingaconfgen_domain_model_appliance.kundeuid" />
</label><br />
	<f:form.select options="{options}" property="kundeuid" /><br />
<label for="ipv4extern">
	<f:translate key="tx_icingaconfgen_domain_model_appliance.ipv4extern" />
</label><br />
	<f:form.textfield property="ipv4extern" /><br />
<label for="ipv4intern">
	<f:translate key="tx_icingaconfgen_domain_model_appliance.ipv4intern" />
</label><br />
	<f:form.textfield property="ipv4intern" /><br />
<label for="sshport">
	<f:translate key="tx_icingaconfgen_domain_model_appliance.sshport" />
</label><br />
	<f:form.textfield property="sshport" /><br />
<label for="passwordnsclient">
	<f:translate key="tx_icingaconfgen_domain_model_appliance.passwordnsclient" />
</label><br />
	<f:form.password property="passwordnsclient" /><br />
<label for="passwordappliance">
	<f:translate key="tx_icingaconfgen_domain_model_appliance.passwordappliance" />
</label><br />
	<f:form.password property="passwordappliance" /><br />
</html>

Here the specific part of the controller:

   public function createAction(\Cjk\Icingaconfgen\Domain\Model\Appliance $newAppliance)
    {	
        $appliancex = $this->objectManager->get('Cjk\\Icingaconfgen\\Domain\\Model\\Appliance');
        $appliancex->setKundeuid($newAppliance->getKundeuid());
        $appliancex->setIpv4extern($newAppliance->getIpv4extern());
        $appliancex->setIpv4intern($newAppliance->getIpv4intern());
        $appliancex->setSshport($newAppliance->getSshport());
        $appliancex->setPasswordnsclient($newAppliance->getPasswordnsclient());
        $appliancex->setPasswordappliance($newAppliance->getPasswordappliance());
        $this->applianceRepository->add($appliancex);
        $this->redirect('list');
    }



More information about the TYPO3-english mailing list