News:

Support the VirtueMart project and become a member

Main Menu

Configuration validation

Started by aix, March 02, 2018, 15:13:03 PM

Previous topic - Next topic

aix

Hei,

I was wondering if anyone has successfully used validation in example Shipping plugin by defineing it in plugin manifest file? I tested it and as far as i see validation is not called. And it is not only with custom validators but it also do not allow to use Joomla built in validators.

For example following code:

<field
                    name="phone_options"
                    addfieldpath="/my/relative/path/to/fields"
                    addrulepath="/my/relative/path/to/rules"
                    type="phoneoption"
                    validate="phoneoptionrule"
                    class=""
                    default=""
                    label="Phone option"
                    description=""
                />


Resulting field is correctly used as custom type but when saveing no validation is called.

At the moment best idea how to do validation is to use method "plgVmSetOnTablePluginShipment", create new \Joomla\CMS\Form\Form object based on manifest and validate it manually. Or is there better way to force validation on plugin configuration fields?