Hi,
I am in the process of adding a new type of form field (Select Dynamic) to my web page in order to let a customer pick from list products in the database in the contact form.
For a test I would just like to replicate the functionality of the static Select field, so what I do is I subscribe to the contentManagement.collectFieldTypes event in my plugin and create a new field type, in this way:
Code:
$newFieldType = new \Modules\standard\content_management\FieldType('IpSelectDyn', '\Modules\CustomFormFields\SelectDyn', $typeSelect . " dynamic", 'ipWidgetIpForm_InitListOptions', 'ipWidgetIpForm_SaveListOptions', \Ip\View::create('view/form_field_options/list.php')->render());
$event->addField($newFieldType);
For now the SelectDyn class just consists of inheriting everything from Select class:
Code:
class SelectDyn extends \Modules\developer\form\Field\Select {
public function __construct($options = array()) {
parent::__construct($options);
print_r($options["values"]);
}
}
The problem I get is that $options does not contain index "values" and thus the drop-down field is empty even though my class does absolutely nothing else except inherits from "Select". The entered values of my SelectDyn field however do get saved in the database and when editing a form they get correctly loaded with the ipWidgetIpForm_InitListOptions Javascript function.
I can't quite figure out the mechanism to debug this error further, can anyone point me in the right direction? I'm using IP 2.2.
Thanks and best regards,
Roman