I'm late to this thread, but I don't see an explanation of **why** Muhammad can't add fields to the existing Form, so I'll try. Please correct me if I'm wrong.
The starting point of the problem is that Form has a copy of its rendered state in a hidden field, and it depends on Form knowing what it rendered. If you put a Zone inside a Form and you refresh the Zone, and the Zone contains input fields (any descendant of Field) then you will usually get an Exception. It's usually a misleading message (something about Form inside a Form IIIRC), but the reason it cannot be allowed is that you're not also refreshing Form's hidden state field. Without FormInjector, the solution, as Thiago has said, is to always submit the whole Form, typically with mode="UNCONDITIONAL" so that no automatic validation is done, and return the whole Form. It can be in a Zone or in a whole page refresh - that's up to you. The important thing is that all of the fields that were rendered get sent to the server, they match with the hidden formstate, and the response includes a new formstate that matches the newly rendered Form. BTW, has FormInjector been reinstated? In the 5.4 api docs I can't see anything that says it's being removed. HTH, Geoff On 18 Dec 2014, at 6:28 am, Muhammad Gelbana <m.gelb...@gmail.com> wrote: > Thanks a lot Thiago for your response. As much as it answers my question, > as much as it makes me sad that I couldn't do it easily using Zones. > > *---------------------* > *Muhammad Gelbana* > http://www.linkedin.com/in/mgelbana > > On Wed, Dec 17, 2014 at 3:18 PM, Thiago H de Paula Figueiredo < > thiag...@gmail.com> wrote: >> >> On Wed, 17 Dec 2014 05:10:53 -0200, Muhammad Gelbana <m.gelb...@gmail.com> >> wrote: >> >> Yea I get. But I won't be able to fill these fields with their default >>> values from the server side. >>> >> >> The user won't see them, so what's the problem? :) Just submit the whole >> form when the Select value changes, so you don't lose the field values, but >> with something that tells the server-side the form isn't ready for updating >> the database yet. >> >> The select component may have unpredictable >>> amount of elements, each element will control what fields to be displayed >>> and what default values should they have. This is all database driver. >>> You solution will work but I'll have to load every possible information I >>> need whenever the page is loaded and save it at the client's browser. >>> But this is not tapestrish, I would've loved to do this the tapestry way. >>> Easy and efficient :) >>> >> >> In this case, if you don't think are suggestions are enough, I believe >> you're trying to use Zone in a scenario more complex than it was designed >> for. Zone was created for simple AJAX updates of a given portion of a page. >> Emphasis on simple. If it doesn't cover what you need for your scenario, >> you'll need to use something else. >> >> This is similar to a couple discussions we already had in this mailing >> list about components such as Grid and BeanEditForm. As Howard once said, >> BeanEditForm, BeanEditor, and Grid (I'd add Zone here) are meant to be used >> to get something working quickly, not to be the solution of all scenarios. >> If you have a too specific scenario, you'll need to write too specific code >> for it. >> >> >> -- >> Thiago H. de Paula Figueiredo >> Tapestry, Java and Hibernate consultant and developer >> http://machina.com.br >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >> For additional commands, e-mail: users-h...@tapestry.apache.org >> >> --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org