You need to sign in to do that
Don't have an account?
developer-force
Validation Message not showing on InputField
I have a custom object MyObject__c. I have created a validation rule for a field in the custom object such as amount__c < 0. I have defined the field in VisualForce page as follows
When I submit the validation work but it does not show the error message similar to what it does in default validation for required rule.
Message Edited by developer-force on 10-14-2008 10:02 AM
Message Edited by developer-force on 10-14-2008 10:03 AM
Code:
<apex:inputField id="amount" value="{!myObject.amount__c}"/>
Message Edited by developer-force on 10-14-2008 10:02 AM
Message Edited by developer-force on 10-14-2008 10:03 AM
may be in your command button code like
<apex:commandbutton immediate="true"/>
if it is then remove immediate="true"
I don't have immediate="true" in my command button. The standard validation are performed. Also the validation is being performed but the message is not displayed.
I observed that if I use <apex:messages /> component it displays the message as expected.
Below is the VisualForce page code and the custom controller code associated with it
The pageBlockSection with id "consignor_group" is the Consignor custom object. The consignor_name__c is required in the Consignor object. It performs the validation but does not show the error message when validation fails.
As I mentioned in my earlier post using the <apex:messages> component displays the message. So don't have a clue is to what I am doing wrong. I appreciate all the help.
Visual Force Page code:
Controller code:
Message Edited by developer-force on 10-16-2008 07:38 AM
Message Edited by developer-force on 10-16-2008 07:39 AM
Message Edited by developer-force on 10-18-2008 12:39 AM
I expect it to appear near the Field in the form as I have selected the Location of the Error to be Field in the validation rule. But this does not work. In order to get the message displayed I have used the <apex:messages> component. This display the error but its behavior is not what I excepted. It displays the validation message as below.
- Weight:should not be less than 0.00
- You must enter a value
- You must enter a value
The "You must enter a value" message is for the standard required validation of the Custom object, which also is displayed near the Input field in the form in red font Error: You must enter a value as expected.I was looking at <apex:messages> component as my work around for my validation message not being displayed near the field in the form as defined.
If I select the validation to appear at location Field, should it be displaying the message very next to the field in the form? If yes this is not happening in my case and what should be the work around?
Thanks a lot for all the help and support I really appreciate the effort taken to answer my queries
Cheers
Message Edited by developer-force on 10-19-2008 02:56 PM