probably your messages wrapped to outputPanel with ajaxRendered=true. And this is proper definition which required for h:messages to be updated sccesfully. But it makes them to be updated on any requests. So you have next possibilities there:
- remove this ajaxRendered=true. And define panels which wraps messages in reRender. So you will add only needed id's
- wrap the main content (without modal panel) to a4j:region with renderRegionOnly=true. So using this way (ifyour page layout allows) It will be still possible to update messages but in the same time nothing outside region will be rendered. But be carefull - if you need to reRender something outside in some case - it will also not be possible.
Would there be a way to clear messages on 'onbeforeload' on dialog. I don't care if it removes messages on main page.
What do you mean by: And define panels which wraps messages in reRender.