In my custom module in system.xml in Admin I have field:

 <field id="user_key" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
       <label>User ID Key</label>
       <comment>Set User Key</comment>

I save that field to database.

I need to trim it before it is saved.

Is there any mechanism to trim it before it is saved?

Something like:

<field id="user_key" trim="1" (...)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.