Skip to content

Latest commit

 

History

History
executable file
·
24 lines (21 loc) · 884 Bytes

File metadata and controls

executable file
·
24 lines (21 loc) · 884 Bytes

3.8 Custom data transformers

You can read here about data transformers. If you already have a custom composite field with the custom Acme\DemoBundle\Form\DataTransformer\MyTransformer view transformer - you should implement it on JS side to prepare the value for the JS validation:

<script type="text/javascript">
    function AcmeDemoBundleFormDataTransformerMyTransformer() {
        /**
         * Some extra option, defined in your transformer. It will be filled from your php class
         */
        this.extraOption = '';

        /**
         * This method is required
         * should return the resulting value
         */
        this.reverseTransform = function(value, model) {
            // Some actions to compose the real value
            return value;
        }
    }
<script/>