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 

Set Default string value to a textbox on my vf page.

I want the textbox on my page to have a String value "True" in the textbox area. It should be set automatically whenever the page is opened/reloaded.
I tried using get & set but did not work. 

Here is what my code looks like -

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

Controller - 
public string searchString {get;set;}

public String getsearchString(){
        return 'True';
    }
    
    public String setsearchString(String searchString){
        if (this.searchString==searchString) {
            return 'True';
    }
        else {
            return null;
        }
        
    }

I dont know but the value in the textbox is not pre-set to "True" when I load the page. Any help will be appreciated?
Shirish DwivediShirish Dwivedi
Hi 

It did not work this way. My textbox still does not have a "true" value written in it.

Is there any other way around?