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.

Use simple HTML link as input for conditional logic

  1. chenyu36
    Member

    I would like to create a simple "learn more" HTML link to show/hide the description of an item, similar to Apple.com order page for each configurable item.
    http://store.apple.com/us/configure/MC511LL/A?mco=MTg1ODA4MDM

    What gravity form has allowed me to do (out of the box) is already very close and I can achieve similar function by using a single "check box" and an HTML description field with conditional logic which uses the check box as input.

    However, instead of a check box, I would like to use a simple "link" which acts as input to the HTML description field.

    Is this possible? Could you suggest other ways to accomplish this? Thank you for the support.

    Posted 13 years ago on Saturday April 2, 2011 | Permalink
  2. You can't use the conditional logic the way you're describing, but you could add some jQuery to show/hide the content on a click event.

    http://api.jquery.com/slideToggle/

    Posted 13 years ago on Sunday April 3, 2011 | Permalink
  3. chenyu36
    Member

    Hi Kevin,
    Thanks for the reference. I am a novice in web programming so pardon my questions if these seemed to be too basic:

    1. I copied and pasted part of the code from the example into an "HTML block" in gravity form.
    here is the part that i copied:

    <style>
    p { width:400px; }
    </style>
    <script src="http://code.jquery.com/jquery-1.5.js"></script>
    <button>Toggle</button>

    <p>
    This is the paragraph to end all paragraphs. You
    should feel lucky to have seen such a paragraph in
    your life. Congratulations!
    </p>
    <script>
    $("button").click(function () {
    $("p").slideToggle("slow");
    });
    </script>

    2. The "toggle" button shows up in the form just like in the example of jQuery page
    3. However, when I clicked the "toggle" button, somehow it caused a reloading of the page and it caused the "submit" to be actuated because the next thing I see, many of the required field were marked red as if I just clicked the "submit" button

    Can you provide more pointers on how to incorporate this show/hide feature? I can see it almost working...
    Thanks for the support.

    Posted 13 years ago on Sunday April 3, 2011 | Permalink
  4. @chenyu36 Kevin was using that as an example of something you could try, you may want to try the support forums on the jQuery site if you need assistance with this jQuery functionality.

    Posted 13 years ago on Monday April 4, 2011 | Permalink
  5. chenyu36
    Member

    Hi Carl,

    Thanks for the clarification. Initially, I was hoping to tap into the existing functionality of gravity forms. Because the toggle function with panel slide in/out can already be accomplished with conditional logic + animation, both features are built in to gravity forms.
    The thing that I notice differently between "html block" in gravity form and other types such as "multiple choices" is that "html block" does not provide a defined "value" to other elements in the form, therefore could not be used as an input to the subsequent element to be used with conditional logic. But if "onclick" on an URL or something similar along that line can be used, then it maybe possible-just a thought.
    If a simple customization is possible, I would love to learn about it from you guys. Thanks for the support.

    Posted 13 years ago on Wednesday April 6, 2011 | Permalink
  6. sascha
    Member

    Hi there,
    was there any solution to this in the end? Let me know...

    Posted 13 years ago on Sunday November 13, 2011 | Permalink
  7. @sascha, please start a new topic and state your question there. It will be easier to give you personalized assistance based on what we know now. Thank you.

    Posted 13 years ago on Sunday November 13, 2011 | Permalink

This topic has been resolved and has been closed to new replies.