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.

HTML Block Conditional Logic Not Working

  1. In continuing to build a form for my site, I am running into a small snag (or at least I hope it's a small snag, regarding the conditional logic of several HTML blocks. As you can view on this page, http://alltheyneedislove.org/adoption-application/, you will see 4 empty fieldsets. The logic works as so...The user clicks "No" for the Will this be your first pet question, then another field appears and asks them to select between 1 and 4 previous pets. Based on that number, the fieldsets with their associated fields would then appear. As it is right now, the fieldset stays, but the fields are working correctly.

    You can see in this screenshot, how I have setup the logic, and its the same logic I have applied to the fields that work correctly: http://grab.by/kCjO

    Any ideas on how to resolve this?

    Posted 7 years ago on Tuesday March 12, 2013 | Permalink
  2. David Peralty
    Administrator

    So the HTML Block isn't showing despite having set conditional logic? What is the content of the HTML block? Also, the image you showed has some style issues. This usually means that there is some theme/plugin conflict. So can you also go through the following steps to confirm your issues aren't coming from a conflict? http://www.gravityhelp.com/documentation/page/Testing_for_a_Theme/Plugin_Conflict

    Posted 7 years ago on Tuesday March 12, 2013 | Permalink
  3. Ok, so I followed that posts instructions and even with the Twenty Eleven theme and only the gravity forms plugin activated, it is still failing to work properly. Again, I'm only trying to show the HTML Block that creates a fieldset if certain conditions are met. The code for the first HTML block is (to close the UL and start the first fieldset):

    </li><!-- close the html field li -->
    </ul><!-- close the list -->
    
    <fieldset id="fieldset_1"><!-- open the first fieldset -->
    <legend>Pet 1:</legend>
    <ul id='gform_fields_4' class='gform_fields top_label description_below'><!-- reopen the list -->

    The second block would be (to close the first fieldset and open a second):

    </li><!-- close the html field li -->
    </ul><!-- close the list -->
    </fieldset><!-- close the first fieldset -->
    
    <fieldset id="fieldset_2"><!-- open the second fieldset -->
    <legend>Pet 2:</legend>
    <ul id='gform_fields_4' class='gform_fields top_label description_below'><!-- reopen the list -->

    I would repeat the second block for as many fieldsets as needed and then use this following code to close the last field set and return back to the normal gforms:

    </li><!-- close the html field li -->
    </ul><!-- close the list -->
    </fieldset><!-- close the second fieldset -->
    
    <ul id='gform_fields_3' class='gform_fields left_label description_below'>

    At this point, I'm at a loss, since I believe I'm following the directions to a "T". Please help!

    Regards,
    Ben

    Posted 7 years ago on Tuesday March 12, 2013 | Permalink
  4. Any further suggestions to resolve this?

    Posted 7 years ago on Wednesday March 13, 2013 | Permalink
  5. David Peralty
    Administrator

    Can you please make sure you are only using single quotes in your HTML inside the block elements? If that doesn't fix it, can you try doing this without mixing conditional logic into the mix to confirm? If you load a form with the HTML blocks and whatnot without conditional logic, does it work as expected?

    Posted 7 years ago on Wednesday March 13, 2013 | Permalink
  6. David,

    I tried changing to single quotes instead of double and leaving the conditional logic, no change. I then left it as single quotes and removed conditional logic and still the same result. Sort of mind boggling. Any other thoughts or suggestions to try?

    Posted 7 years ago on Thursday March 14, 2013 | Permalink
  7. I would take a look at validating the markup on the page:
    http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Falltheyneedislove.org%2Fadoption-application%2F

    There are some problems with the closing of the list and list items.

    Can you link to where you got that code from to open and close the list? You're the second person today who has had a similar problem with adding fieldsets, and I want to check the original code to be sure that it does not contain an error.

    Also, this user today posted a solution to help with adding fieldsets to your Gravity Forms:
    http://www.gravityhelp.com/forums/topic/field-groups#post-170538

    Posted 7 years ago on Thursday March 14, 2013 | Permalink
  8. I got the original code from here:

    http://www.gravityhelp.com/forums/topic/fieldsets

    The other solution you posted did not seem to work at all as far as putting a field set around the group I need. Not sure, I may be implementing it wrong.

    Posted 7 years ago on Thursday March 14, 2013 | Permalink
  9. Going through the validation link you provided, I cleaned up what I could, but it appears as though gravity forms is erroneously adding closing tags where they are not needed or because the HTML block themselves are closing off the list and gravity forms is trying to do the same in order to create the fieldsets. If i gave you access to the admin, can you take a look to see what I might be doing wrong?

    Posted 7 years ago on Thursday March 14, 2013 | Permalink
  10. You got the code from this post?
    http://www.gravityhelp.com/forums/topic/fieldsets#post-17019

    The HTML field in Gravity Forms is inside a list item by default. The code that Kevin provided for you in that post shows how to close the list item and list so you can add your own HTML and have that be outside the list items which are generated normally by Gravity Forms.

    It's tedious work to get right, but if you take one field at a time, I think you should be able to find the source of your problem.

    Posted 7 years ago on Sunday March 17, 2013 | Permalink