1

I am using to get as input certain values. I have set the 'required' attribure of inputText to 'true' but unfortunately, if i do not enter any value to the field then no error shows up.

here is what a piece of my code looks like:

        <apex:pageBlockSection >
         <apex:pageblockSectionItem >
            <apex:outputlabel for="Address_Line1">
            Address Line 1
            </apex:outputlabel>
            <apex:panelGroup >
            <apex:inputText id="Address_Line1" value="{!AddrLine1}" required="true"/>
            </apex:panelGroup>
            </apex:pageblockSectionItem>
            </apex:pageBlockSection>

3 Answers 3

3

When you want to use required attribute that time you have to add < apex:pageMessage> tag in your visualforce page if you will add this that time error automatic display when you not fill that field and click submit button.

1
  • I am using inputText and not inputField.
    – juhi
    Jul 16, 2014 at 20:14
2

As you haven't provided the whole page this is a best guess that you do not have the:

<apex:pageMessages/>

present in the page which is where the "Validation Error: Value is required." error would be presented.

0

Since it is inputText and not inputField it doesn't behave the same way. There is a blog on this topic here that walks you through an alternative way of replicating the error: http://bobbuzzard.blogspot.com/2011/04/field-level-error-messages-with_29.html

2
  • Thanks for help..but I am afraid of using such workarounds as we do not know when the functionality of these styleclass would get changed!!
    – juhi
    Jul 16, 2014 at 19:41
  • You could use <style></style> to create your own but still use the error wrapper method.
    – Jenny B
    Jul 16, 2014 at 20:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.