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
SubhamSubham 

Default Value for InputText

Hi all,

 

The scenario is i want a default value say 'HELLO' to be present For <apex:inputText>

After that user can enter it's own value . so my onclick will clearthe last value 

But I  am not able to set a default value.

 

Here is the code snippet:

 

<apex:inputText  value="{!SomeValue}" onclick="clearinputtext(this);" />

 

Regards,

 

Subham

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
SeAlVaSeAlVa

Have you tried initializing the variable SomeValue in the constructor of your Controller / Extension?

 

Regards

All Answers

SeAlVaSeAlVa

Have you tried initializing the variable SomeValue in the constructor of your Controller / Extension?

 

Regards

This was selected as the best answer
SubhamSubham

In Constructor , it is blank,

I can't put any other value there because a web service callout is made when page loads so whatever i put in constructor it goes to web service as a request parameter

 

isn't there anything like Placeholder in HTML input type = "Text"

SeAlVaSeAlVa

what about setting it with javascript?

craigmhcraigmh

Where is the callout made from? If it's the constructor, you can initialize the value after the callout.

neelam4435@gmail.comneelam4435@gmail.com

take as this example

 

<input name="pg:frm:search" type="text" class="gridDatagrey" id="pg:frm:search" style="height:25px; width:170px; float:left; font-style:italic" value="Search Contacts" />