2 Replies Latest reply on May 25, 2009 5:48 AM by Nick Belaevski

    Modal Panel / Javascript problem!!

    Vlad Ionescu Newbie


      I have a button in a .xhtml file which opens a rich:ModalPanel window defined in other .xhtml. In that .xhtml I have some javascript function which I want to give me the values of some <h:inputText> based on their id's. The problem is that when i try to call something like document.forms[2] this value is null. This form is the 3rd form. I have 3 forms (1st, in the .xhtml file where i have that button that opens rich:ModalPanel, 2nd, in the same .xhtml file but i have also defined there a rich:ModalPanel - so the h:form is inside the rich:ModalPanel, and the 3rd one in the 2nd .xhtml file. I want to make each rich:ModalPanel in it's own file. I tried to declared both of them in the same file, but i face some problems at runtime with actions on buttons and anyway it's a stupid variant - spaghetti code). Back to the problem, I also tried this._form, but returns null either. I tried document.getElementByID("id") which also doesn't work. I supose the form isn't loaded when I open a rich:ModalPanel. Do you know how can i make it load or why this._form and documents.forms[2] returns null? Are there any other methods to retrieve some components id's in jsf / richfaces, besides documents.forms[m].elements[n], where n and m are integers or document.getElementById("id")? components such as <h:inputText> or <a4j:commandButton> etc. Even when the form is loaded, document.getElementById doesn't work for all components.

      Thank you.