File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes Reading <h:message values in javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » JSF
Reply Bookmark "Reading <h:message values in javascript" Watch "Reading <h:message values in javascript" New topic
Author

Reading <h:message values in javascript

Richard Roszak
Greenhorn

Joined: Jan 06, 2009
Posts: 27
In my jsp I have the following:

<h:messages id="detailError" styleClass="priority" showDetail="true" globalOnly="false" layout="list"/>

On a command link in the page I call a javascript. In the javascript I check to see if there are any error messages. Whether I'm generating error or not the length of h:messages is alway zero.

Here is the javascript:

var arr = new Array();

function onPopup(){
arr = document.getElementsByName('form1:detailError');
alert("total # of objects = " + arr.length);
}

What am I missing?

Thanks
Ed Burns
author
Ranch Hand

Joined: Sep 11, 2006
Posts: 69
You probably need to get the *children* of the element. Those will be the elements of the list. What does your firebug (or similar) tell you?

Ed
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Reading <h:message values in javascript
 
Similar Threads
arrays and for each
button inside a h;messages
h:messages have been queued
operator's
Selecting a particular row in <table> tag used.