Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • MK 429 posts 906 karma points
    Mar 29, 2013 @ 10:37
    MK
    0

    Override form validation in razor

    Hi there,

    Is there away to override the form validation?

    I would like to check if email is unique against the member list and return custom validation error if not.

    Cheers

    mkariti

  • Alex Skrypnyk 6175 posts 24176 karma points MVP 8x admin c-trib
    Mar 29, 2013 @ 10:52
    Alex Skrypnyk
    0

    You could use any custom js validation by binding to the input.

    Thanks

  • Comment author was deleted

    Mar 29, 2013 @ 11:13

    If you are using the razor macro there is an event you can hook into to add additional validation rules

    Umbraco.Forms.Mvc.FormRenderController. FormValidate event

    And if you are using the code first approach it should be even easier, check out these examples: http://www.nibble.be/?p=205  (Validate() method)

     

  • MK 429 posts 906 karma points
    Mar 29, 2013 @ 11:22
    MK
    0

    Alex, Tim,

    Many thanks for your reply!

    I'm actually after server validation rather than JQuery one (Which I've already implemented).

    Tim, the Umbraco.Forms.Mvc.FormRenderController sounds good. Do you have by any chance available example?

    I'm assuming that it will be using the Umbraco.Forms.Mvc.dll? 

    I can't get the event I'm after in the above dll.

    Cheers

    mkariti

     

  • Comment author was deleted

    Mar 29, 2013 @ 11:28

    Yup it's in that assembly

  • Comment author was deleted

    Mar 29, 2013 @ 11:28

    But correct namespace is 

    Umbraco.Forms.Mvc.Controllers.FormRenderController. FormValidate

  • MK 429 posts 906 karma points
    Mar 29, 2013 @ 11:31
    MK
    0

    Excellent!

Please Sign in or register to post replies

Write your reply to:

Draft