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 422 posts 1580 karma points MVP 3x 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.

  • Tim Geyssens 6562 posts 15373 karma points MVP 2x c-trib
    Aug 07, 2013 @ 10:00
    Tim Geyssens
    0

    What version of Contour are you running?

  • Nathan Woulfe 422 posts 1580 karma points MVP 3x 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.

  • Tim Geyssens 6562 posts 15373 karma points MVP 2x c-trib
    Aug 12, 2013 @ 11:33
    Tim Geyssens
    0

    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

  • 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