Copied to clipboard

Flag this post as spam?

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


  • Mark 255 posts 612 karma points
    Sep 06, 2016 @ 19:01
    Mark
    0

    Unobtrusive Validation Scripts Affecting Non-Umbraco Form

    We have installed Umbraco Forms package. As a part of the install, we have added the script file references to the head of our Layout.cshtml file, as per this page:

    https://our.umbraco.org/documentation/products/umbracoforms/developer/Prepping-Frontend/

    The problem is, we have several forms that are not Umbraco Forms, that we use on the site, and we need to keep them as they are. But these forms have now stopped working. If I remove the script files, they start working again.

    Is there some way of telling these forms to ignore the scripts? I'm hoping you're not going to tell me that using Umbraco Forms means that it's not possible to use standard forms.

    Thanks!

  • Mark 255 posts 612 karma points
    Sep 07, 2016 @ 07:31
    Mark
    0

    Any response on this? I'm ready to purchase the Umbraco Forms license once this issue is resolved.

    Thanks!

  • Ian 178 posts 752 karma points
    Sep 07, 2016 @ 07:48
    Ian
    0

    Without knowing why your other forms stop working your mielage with this may vary be see this http://www.asp.net/mvc/overview/older-versions/creating-a-mvc-3-application-with-razor-and-unobtrusive-javascript. If you want to disable client side validation on some forms then within the view that hosts these forms you could place the html helpers and set values to false

  • Ian 178 posts 752 karma points
    Sep 07, 2016 @ 07:59
    Ian
    0

    Without knowing why your other forms stop working your mileage with this may vary but see this http://www.asp.net/mvc/overview/older-versions/creating-a-mvc-3-application-with-razor-and-unobtrusive-javascript. If you want to disable client side validation on some forms then within the view that hosts these forms you could place the html helpers and set values to false

  • Mark 255 posts 612 karma points
    Sep 07, 2016 @ 16:21
    Mark
    0

    Hi @Ian,

    Thanks for the info. Unfortunately it hasn't helped. FYI - the problem we are experiencing is that the unobtrusive validation scripts are causing all of our fields to be invalid, no idea why, so the server never gets hit.

    Considering that Umbraco Forms is a package that requires payment for a license, I'd expect the online documentation to cover issues like this. Alas, it looks like we won't be able to use the Umbraco Forms package for our website and will have to code customer forms on an individual basis, by hand.

  • Mark 255 posts 612 karma points
    Sep 07, 2016 @ 17:56
    Mark
    0

    It seems I've stumbled upon a workaround. I couldn't turn off the unobtrusive validation using the means described online, e.g. here.

    But, when I added the formnovalidate attribute to the submit buttons within the form, client side validation stopped working!

    Might help someone at some point...

  • Ian 178 posts 752 karma points
    Sep 07, 2016 @ 18:59
    Ian
    0

    What does the html look like on your other forms? The only reference I could find for formnovalidate was with HTML5 validation rather than anything with unobtrusive client validation.

    with these two lines in your view

    @Html.EnableClientValidation(false);
    @Html.EnableUnobtrusiveJavaScript(false);
    

    do your form fields still have attributes which look like

    data-val="true" data-val-required="some text saying this is required"
    

    As I understand it if these attributes are not anywhere in your form then client side validation should not kick in.

  • Mark 255 posts 612 karma points
    Sep 08, 2016 @ 08:34
    Mark
    0

    Hi @Ian

    That was my understanding too. I could not see those attributes, and the HtmlHelper methods had no affect, but the form validation was obviously doing something, as when I removed the scripts the page worked as normal.

    The lack of documentation from Microsoft (I couldn't find any) regarding unobtrusive validation is concerning. I could only find help regarding MVC3, and none of that was Microsoft documentation. Perhaps somethings changed in the version that Umbraco Forms requires.

    Anyway, the novalidate attribute resolves the issue for now.

Please Sign in or register to post replies

Write your reply to:

Draft