Main Content

Magnolia Community Forums: Get help with Magnolia: Regex Validator for Form Field in Magnolia 5.0


  • Norman
    Norman
    Full name: Norman Hein
    Posts: 11
    Last post: Jan 28, 2014 7:09:46 PM
    Registered on: Jun 20, 2013
    Regex Validator for Form Field in Magnolia 5.0
    #1 by Norman on Jul 16, 2013 4:59:08 PM

    I want to add a regular expression to the password form field. So that a password has to match these criteria.

    Unfortunately I can not find an example and the documentation for magnolia 5.0 does not seem to tell me how I can add a validator to a form field.

    Besides that, in the demo project, I can not assign any validators to the form fields. It just gives me an empty Drop down list, even though they are configured under config/form/validators

    Am I doing something wrong ?

  • rkovarik
    rkovarik
    Full name: Roman Kovařík
    Posts: 66
    Last post: May 16, 2017 3:22:16 PM
    Re: Regex Validator for Form Field in Magnolia 5.0
    #2 by rkovarik on Jul 17, 2013 7:52:46 AM

    Hi Norman,
    you can create custom form field validator the same way as in 4.5:
    http://documentation.magnolia-cms.com/modules/form.html#Creatingacustomregularexpressionvalidator

    Besides that, in the demo project, I can not assign any validators to the form fields

    The selection of validators will be available in Form Module 2.1 which will be part of Magnolia 5.1, see http://jira.magnolia-cms.com/browse/MGNLFORM-179
    but you can set the validation property manually from JCR browser, for example:
    /demo-project/service/contact/content/singleton/fieldsets/0/fields/NUMBER_OF_YOUR_FIELD: add validation property to this node and set its value to NAME_OF_YOUR_CUSTOM_VALIDATOR

    Hope that helps
    Roman

  • Norman
    Norman
    Full name: Norman Hein
    Posts: 11
    Last post: Jan 28, 2014 7:09:46 PM
    Registered on: Jun 20, 2013
    Re: Regex Validator for Form Field in Magnolia 5.0
    #3 by Norman on Jul 17, 2013 6:08:39 PM

    Thanks, that solved my problem.

  • AdrienBe
    AdrienBe
    Full name: adrien be
    Posts: 6
    Last post: Nov 30, 2016 6:52:46 PM
    Registered on: Oct 13, 2016
    Re: Regex Validator for Form Field in Magnolia 5.0
    #4 by AdrienBe on Nov 30, 2016 6:52:46 PM

    I'm late for this party but that might help someone else: http://stackoverflow.com/questions/24360341/how-to-configure-dialog-with-field-validation-in-magnolia/40894738#40894738

    Leave a comment on Stackoverflow if you have any question

You don't have the permission to post on this thread

Sign in

To login on this forum, you can use your Magnolia Forge, Support or Partner account, or, below, your Google, Yahoo! or OpenID account. If you have trouble logging in, or any other sort of issue, please let us know in the Meta forum, on the user-list, or simply by email at forum-admin at magnolia-cms dot com.

* Required

... or sign in with:

  • icon http://{your-openid-url}
  • icon
  • icon https://me.yahoo.com/