UI Components and searchResultToOutput in Magento2

Today I had to fix the following issue in a custom module. The error appeared on the UI Component list view.

I found the reason of the problem in the di.xml file. All what was missing was the following virtualType node. After adding this and re-compiling the code, the list view was fixed.

UI Component Listing And Not registered handle in Magento2

Today I created a new listing for a custom module, but unfortunately all what I got was the error message below.

After digging around for few minutes I noticed the above handler was actually missing in the di.xml file. I simply added the following collections argument and re-compiled the code.

All good!

The requested component (“settings”) is not found. Before using, you must add the implementation.

I tried to implement a simple field validation for a checkbox Apply Special Price which I needed on the Catalog > Product > Edit page. Unfortunately my first attempt below didn’t work and broke the whole grid table.

Here is how I have defined the field apply_special_price in category_form.xml based on different stackoverflow posts.

As I said, it didn’t work at all. So, I kept researching and found a solution which allowed me to implement the validation rule without the nodes <settings> and <formElements> inside of <field>.

Basically, everything has to be defined inside of config otherwise the XML for your custom UI component will be invalid. The section validation allows you to define filters for pretty much every use case. The example below sets a field as mandatory and detects white spaces. Beside that it will make sure the value matches a specific regex pattern.

More validation options are available out-of-the-box.