PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Reverting to Null in Conditional Logic

  1. I would like to know if there is a way to have an field revert to a null value if it is hidden by a conditional logic setting. What I mean is that if someone chooses a main category and then makes a sub-category selection based on that, if they then change their mind and choose a different main category the selection they made on the sub-category would be wiped out.

    Also, is there a way to make 2 conditions? Right now I see that I can show or hide something based on a selection of a different field. Is there a way to show a field if one thing is selected, but hide it if another is selected? And is it then possible to set a level of priority so that if there is a conflict one selection would supersede the others?

    Posted 12 years ago on Monday December 12, 2011 | Permalink
  2. #1 would need to be done with jQuery to watch for the change in the main category, then reset the subcategory.

    You can combine conditions to show or hide a field using show/hide, all/any, is/is not.. Have you tried combinations of those settings? They might not work in your specific situation, but it's hard to tell exactly what you're looking to do without having more specifics. Those are the only options for conditional logic which are built into Gravity Forms. They don't work for more complex types of conditional logic.

    Posted 12 years ago on Monday December 12, 2011 | Permalink
  3. Could you provide further detail on how to implement such jQuery, or a good source that may be informative?

    I have tried different conditional logic combinations, and have made it so my form works well enough, I was just wanting to know if the scope could be expanded.

    Posted 12 years ago on Tuesday December 13, 2011 | Permalink
  4. Can you post a link to your form and let us know exactly what you are trying to accomplish from this point forward?

    Posted 12 years ago on Thursday December 15, 2011 | Permalink
  5. gregreimer
    Member

    I hear you. Same thing here.

    https://www.academieduello.com/school/forms/1-free-lesson-sign-up

    1. Select radio item #1 of radio group level1. This shows another radio group level2, and I select #1 of this levelB group. This shows a date field and I enter a date. L1-1 > L2-1 > datefield
    2. Instead, I select #2 in the level1 group. This shows another radio group level2, and I select #1 of this level2 group. This shows a date field and I enter a date. L1-2 > L2-1 > datefield.

    Problem is, the now hidden radio selection (L1-1 > L2-1) is still "working", and both datefields are visible, even though the original level2 radio group is hidden and is not a part of the decision making process anymore.

    So I would also like any selection that is a "child" of some condition to be de-selected if its parent becomes hidden via conditional logic.

    This is so hard to explain.

    Posted 12 years ago on Monday January 9, 2012 | Permalink
  6. crystales
    Member

    bump. any solutions to this yet?

    Posted 12 years ago on Saturday May 19, 2012 | Permalink
  7. crystales
    Member

    Really would like to implement some jQuery (correctly) to watch for the change in the main category, then reset the subcategories. I found a snippet and tried placing it in my header and referenced .js file, but it doesn't seem to work :/ Any help is immensely appreciated.

    $(document).ready(
        function(){
            $('select').change(
                function(){
                    $('select').not($(this)).find('option:first-child').attr('selected',true);
                })
         });
    Posted 12 years ago on Saturday May 19, 2012 | Permalink
  8. crystales
    Member

    Fixed it! this is the correct code I placed within javascript selectors in the head section of header.php. I just changed the second 'select' to ':hidden' and it seems to be working OK so far...

    $(document).ready(function() {
        $('select').change(function() {
            $(':hidden').not($(this)).each(function() {
                $('option:eq(0)',this).attr('selected', true);
            });
        });
    });
    Posted 12 years ago on Sunday May 20, 2012 | Permalink