+ Start a Discussion
Bhakti GujarathiBhakti Gujarathi 

Disabling a lookUp inputfield on vf page

I have this scenario, where I need to disable the lookup field on vf page on click of a command button. I am able to disable the input field but not the lookup icon. It is still working. I want it to be  displayed on page but in disabled mode.
 
@Karanraj@Karanraj
Use two visualforce page tag <apex:inputField> and <apex:outputField> you can able render any one of the fields in your visualforce page using your command button action. If you want to enable edit permission then set render = false in output field and if you want to disable then set render = false in the input field.
Rohit K SethiRohit K Sethi
hi ,

Use below code for disable the icon of lookup:
<apex:inputField value="{!cont.accountId}" styleclass="myAccount"/>
$(".myAccount").eq(1).attr("onclick","return false;");

Thanks.
Bhakti Gujarathi 6Bhakti Gujarathi 6

$j('[id$=accountInput_lkwgt]').children().removeClass('lookupIcon');

Thanks for help. I just removed the lookup class from that input field.

 

Rohit K SethiRohit K Sethi
hi ,

If you remove the icon class then the "Icon" will not display.
But you said that "I want it to be  displayed on page but in disabled mode." 

So I thing you need to use this code for disable 
$(".myAccount").eq(1).attr("onclick","return false;");
Thanks