problem with rich:message in IE
balazs_hu Apr 15, 2008 5:47 AMHi,
I have a big problem. I have a web page, based on richfaces, and I have a modalPane wich will pop up, if everything is OK on the form (so no validation message occured on the page).
I succesfully solved it and it worked in Firefox, but after it I realized it don't work in Internet Explorer. Here is my solution:
the commandButton which create the popup:
<a4j:commandButton value="#{msg.button_borrow_now}" onmouseover="this.className='on_button'" onmouseout="this.className='button'" styleClass="button" oncomplete="modalopen('borrow_form:error', 'popup_borrow_confirm', {width:450, top:200});"> </a4j:commandButton>
it calls the modalopen script:
function modalopen(matchStr, modalPanel, params) { var s = document.getElementsByTagName("span"); for (i=0; i<s.length; i++) { if (s.id != null && s.id.match(matchStr) && (s.textContent != '' && s.textContent != undefined)) { return; } } Richfaces.showModalPanel(modalPanel, params); };
it examins if there are no validation message on the page (every validation message occures as a span tag, and it contains text which is not empty string and not undefined).
You can see the borrow_form:error parameter. It is important because every rich:message tag's id has this kind of prefix, and in the script I am looking for such span tags, which match. An example:
<rich:message id="error_requestDeadline" for="input_requestDeadline" ajaxRendered="true" styleClass="error"/>
So my problem is, if there are validation messages on the richfaces page and I am using Internet Explorer, the validation span tags don't contain any text inside them. It is interesting for me, because the validation messages are visible, but if I search for them in the source of the page, I can't find them at all. So my script can't it either of course. I can't distinguish between the case with validation messages and the case without them, because I can't find the validation message in the source.
Could anybody help me or suggest a different solution? I hope my description of the problem was clear enough.:)
Thanks in advance,
Balazs