Apex Class :
global class InputText {
public string oppName {get;set;}
public string term {get;set;}
public InputText () {
}
public void saveRecord() {
system.debug('oppNameoppName'+oppName );
}
}
global class InputText {
public string oppName {get;set;}
public string term {get;set;}
public InputText () {
}
public void saveRecord() {
system.debug('oppNameoppName'+oppName );
}
}
Visualforce Page :
<apex:page Controller="InputText" docType="HTML-5.0">
<apex:form >
<apex:pageBlock title="Input Text Field Required" mode="edit" id="block1">
<apex:pageBlockButtons >
<apex:commandButton action="{!saveRecord}" value="Save" />
</apex:pageBlockButtons>
<apex:pageBlockSection title="Opportunity" columns="2">
<apex:pageBlockSectionItem > Opportunity Name
<apex:outputPanel layout="block" style="float: left">
<apex:outputPanel >
<div class="requiredInput"><div class="requiredBlock"/>
<apex:inputText value="{!oppName}" id="oppNameId" />
</div>
</apex:outputPanel>
</apex:outputPanel>
</apex:pageBlockSectionItem>
<apex:pageBlockSectionItem > Term
<apex:outputPanel layout="block" style="float:left">
<apex:outputPanel >
<div class="requiredInput"><div class="requiredBlock"/>
<apex:inputText value="{!term}" id="termId" />
</div>
</apex:outputPanel>
</apex:outputPanel>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
Output :