function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
GoForceGoGoForceGo 

Validations in VisualForce

    Is there any way to handle validation errors in VisualForce?

    As an example, I define a field in a object with some standard salesforce validations rule (e.g a number must be between 0 and 9).

   I am putting a table of these objects.

   Currently, if I type 11 in the field, I get a cryptic visualforce error, not a standard salesforce error which will show me the exact location of the error (row and column)


GoForceGoGoForceGo
Seems like there is a message tag, I played around with it, but it doesn't do anything.

Anyone, on how to write graceful error messages on custom controllers?


jwetzlerjwetzler
One of our developers did a lot of work on validation messages for custom controllers in the upcoming release.  We know it's lacking in it's current state.  I think once the new release is out you'll have what you need (of course bump this thread if it doesn't).

Jill
Steve ChadbournSteve Chadbourn
I would be very interested to see how validation will work in the upcoming release. At the moment I have to put my validation messages as hidden text on the page like this:

Code:
<apex:pageBlockSectionItem>
<apex:outputLabel value="Prior Approval Request" for="priorApproval"/>
<apex:outputPanel styleClass="requiredInput" layout="block">
 <apex:outputPanel styleClass="requiredBlock" layout="block"/>
 <apex:inputField id="priorApproval" value="{!claimNotification.Medical_Prior_Approval_Request__c}"/>
 <apex:outputPanel styleClass="errorMsg" layout="block" rendered="{!errorPriorApproval}">
  <strong>Error:</strong> You must select a prior approval option
 </apex:outputPanel>
</apex:outputPanel>
</apex:pageBlockSectionItem>

As you can imagine, this adds to development efforts and makes the page more difficult to maintain. Plus at the moment any fields marked as required get validated first and my custom validation only gets called after required fields are provided. This type of 2 stage validation does not provide a good user experience.

So I'm very interested in anything that will improve this. Has a date been set yet for the next release?
 

Steve ChadbournSteve Chadbourn

Bump

I have read through the release notes for Summer 08 and cannot see anything about changes to validation rules. Am I missing something? Its a big document (101 pp) so I searched for "validation". If its in there somewhere else please can you give me a page reference.

jwetzlerjwetzler
Just FYI, I forwarded your post to our documentation team.  Our writer does not have this info in the release notes yet but is currently working on it.  I've asked him to reply to the thread when he has more information ready.

Jill