getFormById() can only find forms that are on the current page

  3 posts   Feedicon  
Replies: 2 - Last Post: July 28, 2009 14:41
by: IngoHofmann
« Older Topic » Newer Topic
showing 1 - 3 of 3
 
Posted: July 28, 2009 11:27 by IngoHofmann
Hi,

I am facing a gap for that I could not find a workaround. Perhaps you can help me.

FacesPage.getFormById(String id) can only find a form that is on the current JSF page, since it looks for the children of the current page.

for (UIComponent each : component.getChildren()) { ...


This looks reasonable, but we have now the problem that the <h:form tag is within the template page, not on the actual JSF page.

Example:
page.xhtml contains some input fields (but no form) and uses template.xhtml as template file that contains the form with id "testForm".

In my test class I figured out the following:

Works fine and returns the HtmlForm:
facesPage.getComponentWithId("testForm").getWrappedComponent();

Does not work and brings up a AssertionError("HtmlForm 'testForm' does not exist on page."):
facesPage.getFormById("testForm");

How can I submit the form without using the FacesForm? Or would it be possible to use the facesPage.getComponentWithId() method instead of parsing the children tree at getFormById() ? This should fix my issue, right?

Thanks and regards,
Ingo
 
Posted: July 28, 2009 13:58 by Jason Lee
Let me see if I can duplicate the scenario, then see if we can find a solution we both like.

Thanks for the report (BTW, could you file an issue -- defect or enhancement is fine -- for this?)
 
Posted: July 28, 2009 14:41 by IngoHofmann
Thank you, Jason. I filed an "improvement". Let me know if I can provide any further information on that.

At the end of the day I would like to have the possibility to access a form of the page's template page.
Replies: 2 - Last Post: July 28, 2009 14:41
by: IngoHofmann
« Older Topic » Newer Topic
  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20120127.ac94057)
 
 
Close
loading
Please Confirm
Close