<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Martin Ahrer - Together we&#039;ll make IT &#187; JBoss</title>
	<atom:link href="http://www.martinahrer.at/tag/jboss/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.martinahrer.at</link>
	<description>Java Enterprise Softwareentwicklung und Consulting</description>
	<lastBuildDate>Sun, 11 Dec 2011 16:19:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
<meta name="generator" content="deSignum 0.8.1" />
		<item>
		<title>Keep Rich-Faces modal panel open when form validation errors occur</title>
		<link>http://www.martinahrer.at/2008/03/05/keep-rich-faces-modal-panel-open-when-form-validation-errors-occur/</link>
		<comments>http://www.martinahrer.at/2008/03/05/keep-rich-faces-modal-panel-open-when-form-validation-errors-occur/#comments</comments>
		<pubDate>Wed, 05 Mar 2008 11:01:41 +0000</pubDate>
		<dc:creator>Martin Ahrer</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[JavaServer Faces]]></category>
		<category><![CDATA[JBoss]]></category>
		<category><![CDATA[Rich-Faces]]></category>

		<guid isPermaLink="false">http://www.martinahrer.at/2008/03/05/keep-rich-faces-modal-panel-open-when-form-validation-errors-occur/</guid>
		<description><![CDATA[Keeping a model panel open after form validation produced errors is a bit puzzling. I found some good hints in the Rich-Faces Developer Guide -you need a few lines of JavaScript though;( The guide refers to a Rich-Faces Wiki article and a forum posting. I have slightly modified the solution. On top of the page [...]]]></description>
			<content:encoded><![CDATA[<p>Keeping a model panel open after form validation produced errors is a bit puzzling. I found some good hints in the Rich-Faces Developer Guide<br />
-you need a few lines of JavaScript though;(<br />
The guide refers to a Rich-Faces Wiki <a href="http://labs.jboss.com/wiki/ModalPanelValidation">article</a> and a forum <a href="http://www.jboss.com/index.html?module=bb&#038;op=viewtopic&#038;p=4061517">posting</a>.</p>
<p>I have slightly modified the solution. On top of the page (outside the modal panel) I added a hidden form field that just indicates if validation messages exist.</p>
<pre lang="xml">
<a4j:outputPanel ajaxRendered="true">
	<h:form style="display:none" prependId="false">
		<h:inputHidden id="hasMessages" value="#{menuAdminController.hasMessages}" />
	</h:form>
</a4j:outputPanel>
</pre>
<p>The method property hasMessages is implemented as follows:</p>
<pre lang="Java5">
public boolean isHasMessages() {
	return FacesContext.getCurrentInstance().getMessages().hasNext();
}
</pre>
<p>The button uses the oncomplete attribute to test the hasMessages element with a little bit of Javascript.</p>
<pre lang="xml">
<a4j:commandButton value="#{applicationResources['command.ok']}" action="#{menuAdminController.editedObject.store}"
				oncomplete="if (document.getElementById('hasMessages').value=='false') Richfaces.hideModalPanel('editPanel');" />
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.martinahrer.at/2008/03/05/keep-rich-faces-modal-panel-open-when-form-validation-errors-occur/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

