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
Shirish DwivediShirish Dwivedi 

How to set a string value "True" in an inputText automatically without typing using JS or JS remoting? or any other way?

Here is my vf page code:

<apex:inputText value="{!searchString}" id="txtbxdo" onkeydown="if(event.keyCode==13){this.blur();}else{resetTimer();}" style="width:200px"/>

Here is my controller class

public with sharing class opportunityProductEntryExtension {

    public String searchString {get;set;}
public String getsearchString(){
        return 'True';
    }
    
    public String setsearchString(String searchString){
        if (this.searchString==searchString) {
            return 'true';
    }
        else {
            return null;
        }
        
    }
                  
Kanika DuaKanika Dua
Hi Shirish,
You can try using Constructor for same
public with sharing class opportunityProductEntryExtension {

    public String searchString {get;set;}

public opportunityProductEntryExtension{

searchString = true;
 
}
}
I hope this helps

Thanks and Regards 
Kanika Dua