Search code examples
javascriptjquerysharepointweb-parts

SharePoint | Change Combo Box Options Depending on Same Combo Box Status


Can JavaScript manipulate the options of a combo box?

Idea is to When a status was changes to "B" after submitting the form and the other person change the status "A" should not be an option because it's a previous step.


Solution

  • Hi Guys here's my solution to this.

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
    
    <script>
    
    $( document ).ready(function() {
    
    if($("#ID option:selected").val() == "Initial"){
    
    $("#ID option[value='Initial']").attr("disabled", "disabled");
    //to disable
    
    $("#ID option[value='Invalid']").attr("disabled", false);
    //to enable
    
    }
    });
    </script>