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.

Removing Labels from fields

  1. I'm putting Gravity Form on our homepage using the php include function.

    1) How can I remove the Labels from the fields
    2) How can I make the values inside the inputs to disappear once the input is clicked on?

    Thanks

    Posted 11 years ago on Monday August 27, 2012 | Permalink
  2. I've implemented this for a client that worked great, its semantic and has good fall-back support and validation stays intact.

    There is also a variant way to do this here: http://www.gravityhelp.com/clearing-default-form-field-values-with-jquery/

    Posted 11 years ago on Monday August 27, 2012 | Permalink
  3. That feature is not built into GravityForms? It's a pretty basic feature to click the field and have the the value disappear (it doesnt even need to be jQuery - just a simple line of code inside the <input>

    What about removing the form Labels?

    Posted 11 years ago on Monday August 27, 2012 | Permalink
  4. We purposefully have not built this functionality in yet as we would prefer to do it solely with HTML5 instead of jQuery.

    You can hide labels with CSS - do you have a link to your form?

    Posted 11 years ago on Monday August 27, 2012 | Permalink
  5. Ok. I'll wait for that too.

    Form is on this page: http://www.heritagelawmarketing.com/
    I'm having a hard time styling it though. Seems to be more involved than I thought. I was under impression there are a bunch of templates to choose from and modify rather than having to style it all myself.

    Posted 11 years ago on Thursday August 30, 2012 | Permalink
  6. You can use this to hide the labels (for this specific form):

    [css]
    #gform_wrapper_1 .gfield_label {
    display: none;
    }

    What exactly did you have in mind for styling? I can help guide you here.

    Posted 11 years ago on Thursday August 30, 2012 | Permalink
  7. Yes. I got that part working. I have one problem though, when I set the "Input Value" to be something (Ex. 'Enter Your Name') it seems that the form is taking that as a value and not validating the field for an actual input anymore.

    Posted 11 years ago on Thursday August 30, 2012 | Permalink
  8. That's because it is technically a value and can be submitted. This is one of the drawbacks of using default values as "labels". That's where using the jLabel approach I linked to is more bulletproof. It is a customization and does require some basic knowledge of jQuery and placement in files - but it works great.

    jLabel will take the actual "label" and place it inside of the input and retain validation. You can see a demo of that here which I did for a freelance client.

    Posted 11 years ago on Thursday August 30, 2012 | Permalink
  9. Thanks. Is there a tutorial somewhere on how to implement that with Gravity forms?

    Posted 11 years ago on Thursday August 30, 2012 | Permalink
  10. If you view the source of that page link I sent you, with my example on it. All the way at the bottom you will see a reference to a jLabel file. If you path to that and open it up, just grab that and place it in to your theme. Then just change the selectors as necessary:

    jQuery('#gform_wrapper_1 input:text, #gform_wrapper_2 input:text').jLabel();

    What that is doing is targeting all text inputs in forms with the ID of 1 and 2.

    Posted 11 years ago on Thursday August 30, 2012 | Permalink
  11. Thanks. I did that (copied the jLabel file. Its also going to be for the first form made on my site so the ID number would be the same as yours (#gform_wrapper_1). It didn't work on my site though. Should I be including anything else also?
    http://www.heritagelawmarketing.com/

    Thanks
    Nima

    Posted 11 years ago on Thursday August 30, 2012 | Permalink
  12. Nima,

    It looks like your site is including two versions of jQuery. At the top you have the latest, which is correct. But then further down the page you have a much older version:

    Screenshot

    You also have a JS error: Screenshot

    Posted 11 years ago on Thursday August 30, 2012 | Permalink
  13. You're right. It seems like the slider plugin is adding its own (old) jQuery. i have to see if I can find it and take it out. Thanks for the help

    Posted 11 years ago on Thursday August 30, 2012 | Permalink
  14. Rob,

    I fixed the problem that was pulling extra (old) jQuery into the page. I also added the jLabel script. The form puts still dont change when clicked on.

    Nima,

    Posted 11 years ago on Thursday August 30, 2012 | Permalink

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