Disable “Save” Button Until User Selects “I Agree”

Requirement is: Don’t allow the end user to submit a record until they Agree with the terms and conditions by selecting “I Agree”.

So, we’ve to disable “Save” button until the “I Agree” check box is checked! Here is the jQuery script to achieve the same. Just place this code in your custom list form or in Content Editor Web Part (Place it in a Text file, upload and specify the script in CEWP).

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js" type="text/javascript"></script>

<script language="javascript">

$(document).ready(function(){
 //Disable the "Save" button initially
  $("input[value$='Save']").attr('disabled', true);  

 //alert('jQuery Works');


 //Enable-Disable "Save" button based on "I Agree" checkbox value!
   $("input[title$='Agree to Delete this site']").click(function(){
        if(this.checked)
           {
            $("input[value$='Save']").attr('disabled', false);
           }      
        else
           {
            $("input[value$='Save']").attr('disabled', true);  
           }
     }); 

  });

</script>

Code in action: If  “I Agree” check box isn’t enabled:

Disable "Save" Button Until User Selects "I Agree"

After selecting  “I Agree” check box: Save button enabled!

enable save button

Salaudeen Rajack

Salaudeen Rajack is a SharePoint Architect with Two decades of SharePoint Experience. He loves sharing his knowledge and experiences with the SharePoint community, through his real-world articles!

6 thoughts on “Disable “Save” Button Until User Selects “I Agree”

  • June 7, 2014 at 12:41 PM

    Hi Sir,
    I have used this code for disabling ‘Save’ button, but my other outcome button ‘Reviewed’ stopped to work. Sir, please can you help me with this, I want to disable ‘Save button’ but I want ‘Reviewed’ button to work…

    Thank you in Advance

    Inom

    Reply
  • May 10, 2013 at 3:29 PM

    Thanks,
    But its not working. I hope u can me with this. I have field called Minutes which is a TextBox. When the user enter the numbers I want to check the value should not be less than 15. How do i do that using Jquery.
    I Appreciate your help
    Thanks,
    Stacy

    Reply
  • May 1, 2013 at 4:01 PM

    Hi,
    In the same way.
    how to check if the field is empty or not?. Please let me know
    I apprciateyour help.
    Thanks
    Stacy

    Reply
    • May 2, 2013 at 8:26 AM

      Here you Go:

      if($(‘input[title$=’RequiredTextFileld]’).val() == “”))
      {
      alert(“Please Provide value for Required Text Field!”);
      }

      Reply
  • April 29, 2013 at 9:23 PM

    Hi Salaudeen,

    How to create custom List form ?

    Reply
    • April 30, 2013 at 4:23 AM

      Use SharePoint Designer to create a custom list form and place the code below “PlaceHolderMain”. You can edit the page in Browser, add a CEWP and use the above code as well.

      Reply

Leave a Reply