Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>For completeness, here is the solution I finally found to highlight the fields that do have error messages with IceFaces 2.0.2 :</p> <p>The basic idea is strictly the same than proposed by BalusC on <a href="http://balusc.blogspot.com/2007/12/set-focus-in-jsf.html" rel="nofollow">http://balusc.blogspot.com/2007/12/set-focus-in-jsf.html</a></p> <p>The piece of code I had to change with IceFaces is the small Javascript call :</p> <pre><code>&lt;script&gt; setHighlight('${highlight}'); &lt;/script&gt; </code></pre> <p>I could not find any IceFaces component which is re-rendered at each JS call. I found that placing the script into a panelGroup works most of the time. However, there was a case that did not work : </p> <p>submitting the form with errors do trigger the JS. then, re-submitting the form with errors on the same field than previous validation do NOT trigger the JS. then, re-submitting the form with any error field having no more errors do trigger JS. then, re-submitting the form with any non-errored field having an error do trigger JS.</p> <p>For some reason, IceFaces do not render the panelGroup that contains the JS when the set of fields having errors is the same between two calls.</p> <p>I tried to use the Javascript API with code like Ice.onAsynchronousReceive(), using Prototype library to attach an event to the AJAX completion of the commandButton, but had not much success with it. Some of my tests could run (with errors but did the job) and I could observe similar behavior.</p> <p>Here is the trick I finally used (ugly but working) :</p> <pre><code>&lt;ice:panelGroup&gt; &lt;script type="text/javascript"&gt; var useless = '#{testBean.time}'; setHighlight('${highlight}'); &lt;/script&gt; &lt;/ice:panelGroup&gt; </code></pre> <p>The getTime() function simply return the current timestamp. The value is then always different and trigger the JS execution at any AJAX request.</p> <p>Sadly, IceFaces do not have the RichFaces useful "oncomplete" attribute, which I do regret highly for this case.</p> <p>Ugly solution, but funny and working.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload