Question

I am working with SharePoint 2010 form library.

I have a drop down column which is dependent on text input column value .

The value in the Text input column comes from the infopath form.

What i want is :-

Suppose the text column value is "AU" then disable the Drop down column otherwise enable it.

I want to code this in Sharepoint Form library Edit page(Editpage.aspx).

I think it would be possible with Jquery.

Any help/suggestion would be highly appreciated.

Regards

Kishan

Was it helpful?

Solution

I have solved this problem:

Below is the source of the Javascript attach it with code.

src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"

write this all code in the javasrcipt tag

$(document).ready(function() {    
    // add change handler 
    $("input[title='Test Value']").change(function()     
    { 
        MasterSelectChange();     
    }); 

    // call the change function to set up form for first display: 
    MasterSelectChange();     
});

function MasterSelectChange()    
{    
    var thisVal =  $("input[title='Test Value']").val();      
    if(thisVal == "AU")     
    {     
        $("select[title='Test_Status']").closest("tr").hide
    } 
    else 
    { 
       $("select[title='Test_Status']").show();      
    }     
}

OTHER TIPS

Actually, I guess, you don't need to use JQuery for this. You can disable dropdown using InfoPath too. Just use rules on InfoPath. And you can hide the whole row like this:

$('#>id<').parents().parents().parents().parents().eq(0).hide();

You must reach the parent.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top