formConnector and Yii

Is it possible to use formConnector in Yii?

Is there any documentation/sample on how to do it?

I created the function in my controller:

public function actionForm() { $connector = new FormConnector(null, "PHPYii"); $connector->configure( new Komunikaty(), "id","id, temat,id_user,tresc,data_wpisu,waznosc" ); $connector->render(); }

When I use it in myForm.load(‘./controllername/form/’ + id)
the function returns me tag with all database records in the Komunikaty Table…

When I tried to use this function as data Processor link to insert a new record - it failed.

I even tried the foillowing for loading:

public function actionForm($id) { $connector = new FormConnector(null, "PHPYii"); $connector->configure( Komunikaty::findOne($id), "id","id, temat,id_user,tresc,data_wpisu,waznosc" ); $connector->render(); }

Unfortunately it failed as well.

As to not saving a new record I found that it was CSRF issue. Is it possible to integrate it with YII2’s CSRF token?

Hi,

The Yii integration code uses model->find to fetch records, which will not work for form connector.
We will check how it can be updated, meanwhile you can use REST mode of component instead of connector
( form can load and save data from REST datafeed )

Also, in case of REST approach, you can add any custom fields or headers to the submitted data, including the CSRF token.

docs.dhtmlx.com/dataprocessor__i … ithrestapi

Unfortunately it does not work as well, because dataProcessor tries to send standard POST combination instead of JSON formatted or XML formatted request to the controller.

Does any of the PHP framework connectors work with the form correctly?

In rest mode, connector send form-encoded data only, the same as normal HTML form send to the server side.