Copied to clipboard

Flag this post as spam?

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


  • Nathan Woulfe 447 posts 1665 karma points MVP 5x hq c-trib
    Aug 06, 2013 @ 06:40
    Nathan Woulfe
    0

    Javascript errors with conditional fields

    I have a form where three properties control the conditional display of three other properties - one is a DropDownList, one a CheckBoxList and one a RadioButtonList (in that order). Making a selection in any of the three properties will show/hide subsequent form fields.

    The DropDownList is working fine, the other two throw a javascript error - the CheckBoxList field in the form throws the error on page load load, then the RadioButtonList when a selection is made in either the DropDownList or the RadioButtonList.

    Error:

    Uncaught TypeError: Cannot call method 'indexOf' of undefined
    

    Code causing the error (standard Contour CheckRules()):

    if(
    contourFieldValues["693a8084-c34d-4716-a313-444fd3a98233"].indexOf("visa") != -1)
    

    Pretty sure that's caused by the CheckBoxList and RadioButtonList having no default value when the page loads - since both are mandatory fields I can't set a default, as that defeats the purpose of enforcing those fields.

    Any suggestions on how I can correct this? The form still functions correctly, I just want to clean up the errors.

  • Comment author was deleted

    Aug 07, 2013 @ 10:00

    What version of Contour are you running?

  • Nathan Woulfe 447 posts 1665 karma points MVP 5x hq c-trib
    Aug 08, 2013 @ 00:54
    Nathan Woulfe
    0

    We're running 3.0.6 on a 4.11.8 install.

    Example form is live here - http://www.usc.edu.au/university/jobs-at-usc/how-to-apply/job-application-form [live but not in use - it's an internal demo of a possible solution for online applications], where the fields in questions are title (DropDownList), immigration status (RadioButtonList) and the self identification section (CheckBoxList).

    The form submits properly, so it isn't critical to fix, I just don't like seeing errors... Any ideas would be appreciated.

  • Comment author was deleted

    Aug 12, 2013 @ 11:33

    Hi Nathan,

    Looks like this is an old bug so upgrading should get rid of it for upgrade instructions check http://our.umbraco.org/projects/umbraco-pro/contour/documentation/Installation/Upgrade

Please Sign in or register to post replies

Write your reply to:

Draft