none
Project server date type custom field RRS feed

  • Question

  • Hi all,

    I have date type of custom field in project server and use it in project detail page using project web app web part.Requirement is that when i select and save any date by using that particular custom field.That date should not be editable again after save it.

    any help would be greatly appreciated..

    Thanks


    • Edited by Vivaan Monday, October 7, 2013 12:59 PM
    Monday, October 7, 2013 5:39 AM

All replies

  • Hi Vivaan,

    you could add new HTML Web Part to that Project Detail Page and copy this script to that web part (delete everything else in it).

    The script isn't tested, but it should work. Just replace text "Your field's name here" with your field name:

    <script src="http://code.jquery.com/jquery-latest.js" type="text/javascript"></script>
    <script src="http://code.jquery.com/jquery-migrate-1.0.0.js" type="text/javascript"></script>
    <script>
    $(document).ready(function(){
        var elements=document.body.getElementsByTagName("INPUT");    
        var index = 0;
        
        for (index=0; index < elements.length;++index)
        {
            if(elements[index].type=="text")
            {
                if(elements[index].title=="Your field's name here")
                {
                    if(elements[index].value != "")
                    {                    
                        elements[index].disabled = true;
                        //this is for the date picker
                        elements[index].nextSibling.disabled = true;
                    }
                }
                
            }
        }
    });
    </script>


    Monday, October 7, 2013 1:33 PM
  • though as Mario explained you can easily disable the field by injecting javascript using CEW, but in my personal opinion that might not be a suitable solution, what if someone by mistake entered a wrong date(typical human error) ? in this case the field will remain disabled and you won't be able to edit unless you take off the javascript and re-embedd it,

    Are you using workflow ? if yes then one option could be to make the field read only based on workflow stage


    Thanks | Sunil Kr Singh | http://epmxperts.wordpress.com

    Wednesday, October 9, 2013 6:23 PM
    Moderator