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.

Allow HTML in field label

  1. jochan
    Member

    I think this would be a convenience feature, for example be able to underline or emphasis certain text in the field label. I was trying to italic a book title which is part of a field label, but I couldn't.. instead I need to use quotes.

    Posted 13 years ago on Wednesday May 19, 2010 | Permalink
  2. It will be added in some future release. For now, you can add a little jQuery to your page template to add replace the label with new HTML content.. something like this

    <script type="text/javascript">
    	jQuery(document).ready(function() {
     		jQuery(".gchoice_5_1 label").html('this is a label with <em>italicized text</em>');
    	});
     </script>

    just view the form source and replace the "gchoice_5_1" with your actual field class name.

    Posted 13 years ago on Wednesday May 19, 2010 | Permalink
  3. Hi Kevin,

    It appears your jQuery workaround doesn't allow for adding links to labels...any suggestions there?

    I've got a checkbox on my form with a label that reads: 'I have read and agree to the Terms & Conditions', but would like 'Terms & Conditions' to be a link.

    Thanks in advance!

    Posted 13 years ago on Friday March 4, 2011 | Permalink
  4. HTML worked just fine the last time I tested it.

    http://www.gravityhelp.com/forums/topic/how-to-add-hyperlinks-in-the-form#post-6838

    You can also try Carl's suggestion (using the scrolling section break container style) noted here

    http://www.gravityhelp.com/forums/topic/terms-conditions-in-form#post-19649

    Posted 13 years ago on Friday March 4, 2011 | Permalink
  5. @jkovach That code does work with checkbox labels, I just used it exactly as is. Here is a screenshot of the result:

    http://grab.by/9i3m

    One thing to make sure is jQuery has to be present for that code to work. So if you implemented the code in your theme template but jQuery isn't present, it's not going to work.

    If you post a link to the page where you have implemented this we can take a look and see what is going on.

    Posted 13 years ago on Friday March 4, 2011 | Permalink
  6. Hey guys,

    Here is a link to the form I'm working on: http://www.athleticode.com/register/

    The jQuery is working, because the checkbox wouldn't have a label otherwise, but for some reason the link is just appearing as text...

    Posted 13 years ago on Friday March 4, 2011 | Permalink
  7. @jkovach It isn't working because you are closing the link before it even displays Terms and Conditions because you have a / at the end of the initial anchor container.

    You have:

    <script type="text/javascript">
    	jQuery(document).ready(function() {
     		jQuery(".gchoice_46_1 label").html('I have read and agree to Athleticode's <a href="http://www.athleticode.com/terms-conditions/" target="blank" />Terms & Conditions</a>.');
    	});
     </script>

    You need to remove the / that appears after the target in the link above. So it looks like:

    <script type="text/javascript">
    	jQuery(document).ready(function() {
     		jQuery(".gchoice_46_1 label").html('I have read and agree to Athleticode's <a href="http://www.athleticode.com/terms-conditions/" target="blank">Terms & Conditions</a>.');
    	});
     </script>
    Posted 13 years ago on Friday March 4, 2011 | Permalink
  8. How embarrassing...

    Thanks Carl!

    Posted 13 years ago on Saturday March 5, 2011 | Permalink

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