Copied to clipboard

Flag this post as spam?

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


  • Johan Roug 97 posts 153 karma points
    Sep 26, 2013 @ 22:43
    Johan Roug
    0

    clientside validation fails on contour 3

    Hi

    I have Umbraco version
    Umbraco v6.1.3 (Assembly version: 1.0.4954.19342)

    and Contour version 3

    I run MVC on the website

    It is a clean umbraco install, and clean contour install

    I have made a simple form, consisting of 2 inputs (2 textstrings). One of the inputs is mandatory

    I can insert the form onto my razor file, and the form appears.

     

    PROBLEM

    client side validation fails

    1. Uncaught TypeError: Cannot call method 'setDefaults' of undefined contourform.js:4
      1. (anonymous function)contourform.js:4
      2. (anonymous function)contourform.js:54
  • Johan Roug 97 posts 153 karma points
    Sep 27, 2013 @ 13:26
    Johan Roug
    0

    It seems like jquery validate is not loaded at the right time or something.

    If I comment out line 3-54 in contour.js file, and insert the plugins where all my other scripts for my website are, it works great

    <script type="text/javascript"  src="/Content/js/libs/jquery.validate.min.js"></script>
    <script type="text/javascript"  src="/Content/js/libs/jquery.validate.unobtrusive.min.js"></script>

  • Comment author was deleted

    Sep 30, 2013 @ 11:33

    Yup you need to add the necessary client scripts

    Details here http://umbraco.com/follow-us/blog-archive/2012/11/9/getting-started-with-contour-30-beta.aspx

  • Dennis Milandt 190 posts 517 karma points
    Mar 18, 2014 @ 13:54
    Dennis Milandt
    0

    Shouldn't they be included by default when you do a clean install of Countor in Umbraco 7?

  • Comment author was deleted

    Mar 21, 2014 @ 11:22

    Yeah can add them to the form view but since most people already have jquery ... and don't think there is an easy way to inject them

  • Dennis Milandt 190 posts 517 karma points
    Mar 30, 2014 @ 13:26
    Dennis Milandt
    0

    Well, the JavaScript code from Contour could use it's own jQuery in no-conflict mode? That way, you wouldn't have to worry or even care about jQuery being included on the website at all.

  • Wesley de Roo 38 posts 142 karma points
    May 20, 2014 @ 15:59
    Wesley de Roo
    0

    I've changed line 36 in the contourform.js file in 'umbraco\Plugins\umbracoContour\scripts\Frontend' when getting this error: Uncaught TypeError: undefined is not a function contourform.js:36

    $(".datepickerfield").datepicker({ dateFormat: contourDateFormat });
    

    to

    if ($(".datepickerfield").length > 0) { //checks if the page has a class with .datepickerfield
        $(".datepickerfield").datepicker({ dateFormat: contourDateFormat });
    }
    

    disadvantage is that after upgrading you're losing the change

  • Matthew Hardesty 22 posts 73 karma points
    Nov 20, 2014 @ 07:30
    Matthew Hardesty
    0

    Johan,

    I had the same error as you and spent hours googling and making changes. I think you might be missing jquery.validate.unobtrusive script reference in the head of your document.

    Within the head, make sure you have all these scripts. They are NOT installed to your template automatically. Once I added them, I resolved errors related to contour.js.

    <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.2.min.js" type="text/javascript"></script>
    <script src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.22/jquery-ui.js"></script>  
    <script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.10.0/jquery.validate.min.js" type="text/javascript"></script>    
    <script src="http://ajax.aspnetcdn.com/ajax/mvc/3.0/jquery.validate.unobtrusive.min.js" type="text/javascript"></script>  
    
Please Sign in or register to post replies

Write your reply to:

Draft