Custom Field Type
In certain cases you will need to create a custom field type to achieve specific input abilities.
Let's create grid input field type for custom set of items.
Each custom item in this case has following properties: id number, quantity and description.
Click here for online demo.
We will be creating new extension called Mageme_Items.
This file holds information for composer script
This file registers module in Magento system. Without this file the module is not visible.
In this file we holds basic description of our module. We need to set the sequence so the module is loaded after the main WebForms extension.
This file registers our event handler function.
Following events are being used:
webforms_fields_types - this event is used to register new field type in the select list
webforms_fields_tohtml_html - this is used to insert our custom field html frontend template
webforms_result_save - this event is used to process raw field submission data and can be used for extra actions
webforms_block_adminhtml_results_grid_prepare_columns_config - this event is used to render field value in result grid
webforms_results_tohtml_value - this event is used to render field value in result grid
Here we define our backend grid column renderer. We are decoding data from JSON format and displaying it line by line as text
Here we register our backend grid column renderer.
This file formats field value for email notifications and result view pages.
Here we insert the field frontend template.
This file is used for custom result processing.
This file is used to register our field type.
Thats it! Feel free to modify this extension, experiment and add required post processing functionality to WebForms.
You can download sources here.