+ Start a Discussion
SurajCovelixSurajCovelix 

Making a field required on the VF page not working

Hi,

I am trying to make a field required in my VF page but its not working for some reason.

VF code :

 

<apex:outputLabel value="First Name" for="firstname"/>
<apex:outputPanel styleClass="requiredInput" layout="block" id="pwPanel" >
<apex:outputPanel styleClass="requiredBlock" layout="block"/>
<apex:inputText value="{!FirstName}" id="firstname" required="true"/>
</apex:outputPanel>

 

What's the matter?

APathakAPathak

Hi,

Please see this working code :-

 

<apex:page controller="hello17controller">
<apex:pageMessages />
<apex:form >
    <apex:pageblock >
        <apex:pageBlockSection >
            <apex:pageBlockSectionItem id="ToUser">
            <apex:outputPanel layout="block" styleClass="requiredInput">
                <apex:outputPanel layout="block" styleClass="requiredBlock"/>
                <apex:inputText required="true" value="{!vark}"/>
            </apex:outputPanel>
            </apex:pageBlockSectionItem> 
        </apex:pageBlockSection>
    </apex:pageblock>
</apex:form>
</apex:page>

 

salesforcequestions123salesforcequestions123

 field required will work for only input field not for output field
Highlight it
required="true"