ads

Friday, 17 August 2018

Visible required symbol in apex:inputText

Code Format:

VisualForce Page:

<apex:page controller="makeRequired">

    <apex:form >

        <apex:pageBlock >

                <apex:pageBlockSection >

                <apex:pageBlockSectionItem >

                   <apex:outputLabel value="Account Name"/>

                    <apex:outputPanel styleClass="requiredInput" layout="block" >

                    <apex:outputPanel styleClass="requiredBlock" layout="block"/>

                    <apex:inputText value="{!str}" required="true"/> 

                    </apex:outputpanel>

               </apex:pageBlockSectionItem>

                </apex:pageBlockSection>

        </apex:pageBlock>

    </apex:form>

</apex:page>


Apex Class:

public with sharing class makeRequired { 

    public String str {Get;set;}
    
    public makeRequired() {
    }    
 
}

Output:

No comments:

Post a Comment