+ Start a Discussion
Stéphanie ParkStéphanie Park 

How to include the field label inside the field on a VP page.

We have a VF page on our website that contains the following forms. We'd like to include the labels inside each field instead of having them above. Any solution? 
 
<apex:form id="mainForm">
       <apex:pageBlock >
       <apex:messages /><br/>
       {!$Label.FirstName}<br/>
       <apex:inputField value="{!lead.FirstName}" label="First Name" style="width:40%"/><br/>
       {!$Label.LastName}<br/>
       <apex:inputField value="{!lead.LastName}" required="false" style="width:40%"/><br/>
       {!$Label.Email} <br/>
       <apex:inputText value="{!lead.Private_Email__c}" style="width:40%"/>   <br/> 
      <apex:commandButton value="{!$Label.ConfirmRegistration}" action="{!confirmRegistration}"/><br/>

 
Best Answer chosen by Stéphanie Park
GovindarajGovindaraj
Hi Stephanie,

If you're talking about having the label inside field then probably you can use 'Placeholder'.

<apex:inputField value="{!lead.FirstName}" html-placeholder="First Name"  />

Thanks,
Govindaraj.S

All Answers

GovindarajGovindaraj
Hi Stephanie,

If you're talking about having the label inside field then probably you can use 'Placeholder'.

<apex:inputField value="{!lead.FirstName}" html-placeholder="First Name"  />

Thanks,
Govindaraj.S
This was selected as the best answer
Stéphanie ParkStéphanie Park
Hi!
Thanks! I had tried with only placeholder="First Name" and it was not accepted... I didn't know that trick! 

Works well!