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.

Grey out submit button

  1. Anonymous
    Unregistered

    I noticed this post which is close to what I want, http://forum.gravityhelp.com/topic/hide-the-submit-button-conditionally, but not exactly. What I want to do is disable the submit button, not the data that is contained within the form.

    The website is behind a firewall on an intranet, so I can't give you the link, but here is the source for the form.

    Since there is no id for the the submit button, I am not sure how to do it.

    <div class="gform_wrapper" id="gform_wrapper_1">
                    <form method="post" enctype="multipart/form-data" id="gform_1" class="" action="">
                            <div class="gform_heading">
                                <h3 class="gform_title">Got something to share with the rest of us?</h3>
                            </div>
                            <div class="gform_body">
                                <input class="gform_hidden" name="is_submit_1" value="1" type="hidden">
                                <ul id="gform_fields_1" class="gform_fields top_label"><li id="field_1_2" class="gfield"><label class="gfield_label" for="input_1_2">Subject<span class="gfield_required">*</span></label><div><input name="input_2" id="input_1_2" value="" class="small" tabindex="1" type="text"></div><li id="field_1_3" class="gfield"><label class="gfield_label" for="input_1_3">Phone<span class="gfield_required">*</span></label><div class="ginput_container"><input name="input_3" id="input_1_3" value="" class="medium" tabindex="2" type="text"></div><li id="field_1_4" class="gfield    foobar"><label class="gfield_label" for="input_1_4">Tell us more:<span class="gfield_required">*</span></label><div><textarea name="input_4" id="input_1_4" class="textarea small" tabindex="3" rows="10" cols="50"></textarea></div>
    
                            </div>
                            <div class="gform_footer top_label"><input class="button" value="Tell Us!" tabindex="4" type="submit">
                            </div>
                    </form>
                    </div>
    Posted 10 years ago on Tuesday February 16, 2010 | Permalink
  2. Hey Danny,

    I'm not 100% sure what you're trying to do, but you can disable the button by adding the "disabled" attribute with some script. You can drop this in your header.php file or page template. If you're already loading jQuery for your theme, you can omit the first script reference.

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>
      <script type="text/javascript">
      $(document).ready(function() {
    
        $('#gform_1 input[type=submit]', this).attr('disabled', 'disabled');
    
      });
     </script>

    where the "gform_1" above is your form ID.

    test screenshot

    If you just wanted to hide the button completely, you can do this with some simple css inheritance.

    #gform_1 .gform_footer .button {display:none;}

    Posted 10 years ago on Tuesday February 16, 2010 | Permalink
  3. Anonymous
    Unregistered

    The first case is exactly what I wanted. Now how would I invoke it a second time to re-activate it? I am making sure the the user is logged in via Active Directory before they can submit the form. I can do the php, just need to know how to call it again.

    thanks,
    Danny

    Posted 10 years ago on Tuesday February 16, 2010 | Permalink
  4. If you're already checking to see if the user is logged in, I would simply apply the method above if they are NOT logged in, and default to the normal button behavior if they are.

    Posted 10 years ago on Tuesday February 16, 2010 | Permalink
  5. Anonymous
    Unregistered

    This can be closed, It works perfectly. Thanks, for the help!

    Posted 10 years ago on Wednesday February 17, 2010 | Permalink

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