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
Steve ChadbournSteve Chadbourn 

How to validate individual wizard pages

I have created a set of wizard pages using visualforce based on the examples in the developers guide. The thing I am struggling with though is how to validate fields on a page when the next/previous button is clicked.
 
I can mark a field as required and it flags an error when I click next. Validation rules however do not seem to fire.
 
I can do a certain amount of validation in the custom controller but how do I display the error message? outputText? This is not really the place for the validation logic either - it should be in the custom object the wizard is based on.
 
Any ideas anyone?
Ron HessRon Hess
just a guess, but if you did a save of the objects on each page before moving to the next page, the object validation logic should be applied with proper error messages blocking the move to the next page in the wizard.


Steve ChadbournSteve Chadbourn
I have followed the example in the Visualforce developers guide and have created a custom object that spans several wizard pages (9 pages in my wizard). Some of the fields that are marked as required do not appear until later pages. If I try and save the object on page 1, a required field that appears on page 3 will raise an error won't it?