Copied to clipboard

Flag this post as spam?

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


  • MK 426 posts 902 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 5908 posts 22603 karma points MVP 4x admin c-trib
    Mar 29, 2013 @ 10:52
    Alex Skrypnyk
    0

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

    Thanks

  • Tim Geyssens 6562 posts 15373 karma points MVP 2x c-trib
    Mar 29, 2013 @ 11:13
    Tim Geyssens
    0

    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 426 posts 902 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

     

  • Tim Geyssens 6562 posts 15373 karma points MVP 2x c-trib
    Mar 29, 2013 @ 11:28
    Tim Geyssens
    0

    Yup it's in that assembly

  • Tim Geyssens 6562 posts 15373 karma points MVP 2x c-trib
    Mar 29, 2013 @ 11:28
    Tim Geyssens
    100

    But correct namespace is 

    Umbraco.Forms.Mvc.Controllers.FormRenderController. FormValidate

  • MK 426 posts 902 karma points
    Mar 29, 2013 @ 11:31
    MK
    0

    Excellent!

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies