Friday, July 31, 2015

get current loggedin user ,hide iput fields fro specific users

<script type="text/javascript">
    $(document).ready(function() {
    //set text box width...
       $('input[title="Name Required Field"]').width('200');
     
       $('input[title="Office/Work Location"]').width('200');

   
     // get current logged in user  
         var res = $().SPServices.SPGetCurrentUser({
fieldName: "Name",
debug: false
});
var rows = $('table.tg tr');
var tr1 = rows.filter('.tr1');
var tr2 = rows.filter('.tr2');
var tr3 = rows.filter('.tr3');
var tr4 = rows.filter('.tr4');
var tr5 = rows.filter('.tr5');
var tr6 = rows.filter('.tr6');
var tr7 = rows.filter('.tr7');
var tr8 = rows.filter('.tr8');
var tr9 = rows.filter('.tr9');
var tr10 = rows.filter('.tr10');
var tr11 = rows.filter('.tr11');
var tr12 = rows.filter('.tr12');
var tr13 = rows.filter('.tr13');
var tr14 = rows.filter('.tr14');
var tr15 = rows.filter('.tr15');
var tr16 = rows.filter('.tr16');
var tr17 = rows.filter('.tr17');
var tr18 = rows.filter('.tr18');
var tr19 = rows.filter('.tr19');
var tr20 = rows.filter('.tr20');
var tr21 = rows.filter('.tr21');
var tr22 = rows.filter('.tr22');
var tr23 = rows.filter('.tr23');

//alert(res);
var t=res.split('|');
//alert(t[2]);
//........................  members..............//
//jhenderson@****.com
//ajohnson@****.com
//anguyen@**.com(or)idruke@**.com
//krushe@***.com
//tgarrett@***.com
//
//
//hide specific input boxes(in my case its table,so hided <tr> in this code)
if(t[2]=="rkumar@***.com")
{
//alert(t);
//alert("iam the user");
 tr1.hide();tr10.hide();tr4.hide();tr2.hide();tr1.hide();tr22.hide();
 }
   
    });
</script>

No comments:

Post a Comment