• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Reading <h:message values in javascript

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
author
Posts: 82
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
reply
    Bookmark Topic Watch Topic
  • New Topic