+ Start a Discussion
nishanth0208nishanth0208 

Making a field Uneditable/Read-Only in Custom Object's Visual Force page ?

Hi All,

 

         I had a requirement of making a field Read-Only in an object's page. I am able to make it read-only using the code like below:

 

// var noofpackage1 = document.getElementById("{!$Component.formid.pageblockid.noofpackage1}");

noofpackage1.disabled=true;

 

But in this context, i kept some value in that read-only field while page load itself.  The problem here i got is 

           IF I GIVE THE VALUE AS "1", AT THE TIME OF PAGE LOAD I CAN SEE THE VALUE, BUT I AM NOT ABLE TO SAVE THE RECORD WITH THAT VALUE. THE VALUE IS DISAPPEARING WHILE I AM TRYING TO SAVE. AND THE POST SAVE PAGE(VIEW PAGE) IS NOT SHOWING THE VALUE WHICH I TRIED TO ASSIGN AT THE TIME OF PAGE LOAD.

            i am using Professional Edition. I cant make the field read-only in page layout since i am using VF page and i cant make the field read-only in Profile page since PE does nt contains profiles.

Help me out in achieving this guys.

      Tons of thanks,.

-

krishna

Edwin VijayEdwin Vijay

Hi,

 

Is there any reason for using javascript???

 

If you are using inputfield or something it already has a property called "disabled"....

 

Thanks,

Edwin

 

 

bmabma

Can you use outputField to accomplish what you are doing?