Copied to clipboard

Flag this post as spam?

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


  • Simon Dingley 1470 posts 3427 karma points c-trib
    May 22, 2014 @ 11:26
    Simon Dingley
    0

    Umbraco v4 / Contour 3.0.19 Conditional Fields Not Saving

    We recently had to do a manual upgrade to the latest supported v4 version of Contour and are experiencing issues with the conditional logic.

    The first issue is with regards to using a checkbox to set the condition, there is no value to enter into the rule because the checkbox outputs no value?

    The second issue is that saving a rule and updating the field does not save changes and does not generate any visible error to indicate why the data wasn't saved.

    Any ideas?

    Thanks, Simon

  • Comment author was deleted

    May 22, 2014 @ 11:45

    Checkbox use true or True (one of those should work)

    Make sure to hit the add button when setting up a new rule

  • Simon Dingley 1470 posts 3427 karma points c-trib
    May 22, 2014 @ 12:23
    Simon Dingley
    0

    Thanks Tim, got the rules saving now and tried with both true and True values with no success. See attached example:

    enter image description here

    Additionally when you view the preview output there is no value specified on the checkbox field - I wonder if that may be a cause?

    <input type="checkbox" name="15223250-cbb4-43a6-ad15-5cbc7a027dee" id="15223250-cbb4-43a6-ad15-5cbc7a027dee">
    
  • Richard Barg 358 posts 532 karma points
    May 23, 2014 @ 08:02
    Richard Barg
    0

    Tim,

    We are also having problems w/conditonals.

    First, we upgraded to Umbraco 4.11 as you suggested to us a year ago. We are running the latest version of Contour, 3.0.21 . I confirmed the following features work:

    1. Creating folders
    2. Dragging elements in lists
    3. There is a settings button.

    However conditionals fail as described below:

    1. First, re: the first image below, let me confirm this. You have to hit the add button. That's not exactly obvious at least to me. So if you add a condition by hitting the plus button, the condition is added, then another line is inserted with a field name in it and "Enter a Value". I am assuming unless you enter the value, that line is ignored. My law degree and MBA weren't enough to prevent me tripping over this.

    2. Also to confirm: I selected "Edit Insert form from Umbraco Contour (Razor)" in the Content area and did NOT select Edit Insert form from Umbraco Contour. Is that correct? Would you please explain the difference?

    3. The problem we are having (see images below) is that when the condition is set to Hide, the field "phone number" shows, but when I type in "Barg", the required condition, in the "Your name" field, the phone number field fails to render on the form as it is supposed to. The exact opposite happens when the condition is Show. So the field is initially being recognized by Enable Conditions, but the conditions are not executing. I also tried this w/checkboxes - same issue.

    What do you suggest?

    Also could you clarify the MVC requirement? We are running 4.11 and but are not generally making use of MVC forms. I'm a content editor so I don't know much about MVC, but my understanding is being on 4.11 and contour 3.0.2 are sufficient to use conditions.

    Value will not Save

    Blank value for second field

  • Simon Dingley 1470 posts 3427 karma points c-trib
    May 23, 2014 @ 09:19
    Simon Dingley
    0

    First, re: the first image below, let me confirm this. You have to hit the add button. That's not exactly obvious at least to me. So if you add a condition by hitting the plus button, the condition is added, then another line is inserted with a field name in it and "Enter a Value". I am assuming unless you enter the value, that line is ignored. My law degree and MBA weren't enough to prevent me tripping over this.

    Tim, I have to say that I agree with this, it's particularly unclear because the + button has a tooltip which says "add another rule" instead of "Save Rule". You then have to remember to click "Update Field" before finally clicking to save the Form. That's 3 saves for one change.

    Also to confirm: I selected "Edit Insert form from Umbraco Contour (Razor)" in the Content area and did NOT select Edit Insert form from Umbraco Contour. Is that correct? Would you please explain the difference?

    Insert form from Umbraco Contour (Razor) uses a razor script to write the form into the page whereas the other uses a .Net UserControl.

  • Richard Barg 358 posts 532 karma points
    May 23, 2014 @ 09:39
    Richard Barg
    0

    @Simon re: "Insert form from Umbraco Contour (Razor) uses a razor script to write the form into the page whereas the other uses a .Net UserControl." What governs the choice? When do you select razor and when do you select .Net?

    @Tim - "That's 3 saves for one change". - yes very ponderous and especially frustrating when it doesn't work.

  • Simon Dingley 1470 posts 3427 karma points c-trib
    May 23, 2014 @ 10:00
    Simon Dingley
    0

    @Simon re: "Insert form from Umbraco Contour (Razor) uses a razor script to write the form into the page whereas the other uses a .Net UserControl." What governs the choice? When do you select razor and when do you select .Net?

    I think the .Net UserControl is a legacy thing, whereas the Razor version uses MVC views which are more easily customised but Tim may wish to clarify that.

  • Comment author was deleted

    May 23, 2014 @ 10:02

    Yeah usercontrol is legacy and doesn't support conditions :) good point about the add... will update tooltip

    For the checkbox will check why that isn't working

  • Richard Barg 358 posts 532 karma points
    May 23, 2014 @ 10:23
    Richard Barg
    0

    @tim we're using the razor control, not the legacy control, but the conditionals still are not working. This is true whether where the field is a checkbox or a text field. You have any idea why this is not working as described above?

    @simon did you ever get your conditionals working per the message that started this thread?

  • Comment author was deleted

    May 23, 2014 @ 10:24

    RIchard, any js errors?

  • Comment author was deleted

    May 23, 2014 @ 10:29

    And make sure to run the latest version since it might be a bug that is already fixed

  • Richard Barg 358 posts 532 karma points
    May 23, 2014 @ 11:26
    Richard Barg
    0

    @Tim - I will give you a brief bit of history. We were running 4.71 of Umbraco and Contour Package version 1.1.12 for many years. We now have 4.11.10 running on production and now that it is stable we upgraded Contour on our development site (also running 4.11.10) to Umbraco Contour Package version 3.0.21. I assume my developer has installed 3.0.21.ForV4.zip, the version for 4.11.10. Let me also say that Contour is one of the most valuable programs we have and the conditionals are a crown jewel of the latest version. That's why I am up at 2:15 a.m. PDT, pounding out emails.

    My developer indicated the Contour upgrade was anything but easy. I'm sure he followed the upgrade instructions. We have been down this road many times before with Umbraco upgrades and such and we always looking out for minefields.

    In terms of the error, it does seem that if the conditional is actually hiding the field as expected when the form displays, but then doesn't execute the conditional as you move thur the form, the program is at least working, but is getting hung up at some point.

    The installations states:IMPORTANT: "This installer will need modify rights to folders: /bin, /umbraco, /usercontrols and the web.config,as well as be allowed to create tables in the database to be able to perform the following changes". So the question, since this is an upgrade, whether the installer worked correctly. Perhaps /bin files are out of date, left over from the 1.x version etc.

    You asked me about .js errors. I don't see anything in the status bar when I go thru the form on the front side. But I suspect you are talking about some sort of debugging process that my developer would do.

    So I will ask him about .js errors. Can you provide any other guidance such as how we would trace the error? Is there an error log? Do you want us to post the list of files in our installation to see if perhaps one of the dlls is out of date. Not being a programmer, I'm somewhat guessing. I can pass along your suggestions to my developer in 6 hours and he can post to this thread as well. Just tell me what you need. Thanks.

  • Richard Barg 358 posts 532 karma points
    May 23, 2014 @ 11:43
    Richard Barg
    0

    Keeping it very simple. The screens below speak for themselves.

    Contour settings

    Rendered on Form

  • Richard Barg 358 posts 532 karma points
    May 23, 2014 @ 19:28
    Richard Barg
    0

    @Tim - I did speak to our developer and he will look at the JS in the console. However, in the terms of the installation, he was confused by the lack of clarity on the download page.

    The headings are unclear and you never state with specificity which versions the "upgrade" refers to, ie. "To Upgrade Download the Contour3.0.21upgrade.zip and unzip its contents in the root of your website, installation guid is available as a pdf below" However there is no such file with that name.

    For updating, however, as opposed to upgrading, the update download applies by its terms only for version 6 and 7. Are you no longer supporting version 4 for updates?

    In any case, all of this is confusing and involves a lot of guesswork. Please address and clarify these installation issue because the notes on your package files do not and it appears the download page is not really being maintained in a way that is lucid to developers.

    No file shown Contour<em>3.0.21</em>upgrade.zip - Update only applies to version 6 and 7

  • Richard Barg 358 posts 532 karma points
    May 23, 2014 @ 20:42
    Richard Barg
    0

    @ Tim I finally got the conditional logic to work (at least for textboxes). The problem it turns out is that conditional logic does not work for forms within folders. I have posted a separate form item for this:

    http://our.umbraco.org/forum/umbraco-pro/contour/53101-Conditional-Logic-Fails-to-Execute-When-Folders-are-used-in-3021-(Bug)

    Checkboxes still do work. The checkboxes are the raison d'etre of Contour 3.x - clearly the most important feature. Please fix it!!!!

  • Richard Barg 358 posts 532 karma points
    May 23, 2014 @ 21:14
  • Richard Barg 358 posts 532 karma points
    May 24, 2014 @ 22:02
    Richard Barg
    0

    @Simon & Tim - Guess What. The conditionals are now working for me for checkboxes, radio buttons and dropdowns where a value in one of those shows or hides a text field.

    I can only say that the combination of the folder bug and the need to do three saves contributed to the problem.

    @Simon - not sure why your's isn't working.

  • Richard Barg 358 posts 532 karma points
    May 24, 2014 @ 22:04
    Richard Barg
    0

    @Simon - I think what is broken is when there is only a single checkbox w/a true or false value. If you have multiple check boxes, conditional logic works fine. You might try using two radio buttons - yes and no instead of the checkbox until Tim fixes this.

  • Simon Dingley 1470 posts 3427 karma points c-trib
    May 27, 2014 @ 13:33
    Simon Dingley
    0

    I've found what I think is the source of the issue.

    Having a single checkbox generates a script like the following:

    function CheckRules0fce165915d84146933a5d09ef4cc27e() {   
    
        if (
            (contourFieldValues0fce165915d84146933a5d09ef4cc27e["15223250-cbb4-43a6-ad15-5cbc7a027dee"] != null &&
                contourFieldValues0fce165915d84146933a5d09ef4cc27e["15223250-cbb4-43a6-ad15-5cbc7a027dee"] == "True"
            )
        ) {
            $("#95d9a925-b7a4-4250-8262-6146572381c3").closest(".contourField").show();
    
        } else {
            $("#95d9a925-b7a4-4250-8262-6146572381c3").closest(".contourField").hide();
        }
    
    }
    

    I've fired up Firebug and found that the value being reported by checkbox is "true" and not "True" so the check always returns false and the control is never shown.

    I then found this:

    if ($(this).attr('type') == "checkbox") {
        if ($(this).attr('id') != $(this).attr('name')) {
            if ($(this).is(':checked')) {
                if (contourFieldValues0fce165915d84146933a5d09ef4cc27e[$(this).attr("name")] == null) {
                    contourFieldValues0fce165915d84146933a5d09ef4cc27e[$(this).attr("name")] = $(this).val();
                } else {
                    contourFieldValues0fce165915d84146933a5d09ef4cc27e[$(this).attr("name")] += "," + $(this).val();
                }
            }
        } else {
            contourFieldValues0fce165915d84146933a5d09ef4cc27e[$(this).attr("name")] = $(this).is(':checked').toString();
        }
    }
    

    Unfortunately this product is closed source so I can't address the issue but @Tim you need to change this to check against a lowercase "true" value returned by the browser when checking if the box is checked or not.

  • Simon Dingley 1470 posts 3427 karma points c-trib
    May 27, 2014 @ 13:53
    Simon Dingley
    0

    @Richard not working for with radio buttons either

  • Simon Dingley 1470 posts 3427 karma points c-trib
    May 27, 2014 @ 14:10
    Simon Dingley
    0

    @Richard, I found that the radio buttons were not working for me due to the fact that I was missing some of required css classes from my forms. Unfortunately some of them are explicitly required as hooks for the jQuery to control the visibility of conditional fields.

Please Sign in or register to post replies

Write your reply to:

Draft