function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
test269test269 

Disable inputtext field using jquery by default

Hi All,

 

    I have one picklist field in vf page not a custom field.This can be written using select options..This value is disable when automatically run tehg page.For this i have used disabled=true.Its disabled the value by default.It works fine,But the value is getting empty whenever using disabled=true.So for  this i have to use JQuery.Any one can u please help me this.

 

 

Thanks in advance

Navatar_DbSupNavatar_DbSup

Hi,


Inputtext display values whenever there is a value for this but it’s in disable format. So insted you can bind the disable value dynamicaly. Try the below code as reference:

 

<apex:page controller="InputText">
<apex:form >
<apex:inputText value="{!Name}" disabled="{!bool}"/>
</apex:form>
</apex:page>

 

///////////////////////////////////// Controller  ///////////////////////////////////////

public class InputText
{

public String Name{get;set;}
public boolean bool{get;set;}
public InputText()
{
//Name='Test123';
if(Name == null)
{
bool=true;
}
}

}

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.