Brendan Healey wrote:
About 10 times a week I see someone on here or somewhere else who have multiple forms on a single
page and every time they're in trouble.
Use one form with prependId="false" and everything will start to become a lot simpler. Read up about
naming containers also.
Brendan.
SCJP, SCWCD
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.
Tim Holloway wrote:You don't really "update" a form, you submit it. The updating can be done to any region up to and including the entire page (which is the default, unless you use AJAX).
Use a form to contain the greatest common denominator of all the control values that you wish to submit (and thus validate) in a single request. Use AJAX if you need to sub-divide the form into partial form requests. There are definitely times when multiple forms on a page are useful, such as cases where the main input source is a data table display and associated controls but you want to have an independent "search" request that works without the overhead of uploading all the main form control values or being dependent on all of those values being valid (since even one invalid control value will cause the entire request to be rejected).
The AJAX "render=" attribute is used to indicate what region(s) of the page to re-render after the submit is processed. Regions, as I said, can be anything renderable. Single controls, dataTables, panelGrids, and so forth.
SCJP, SCWCD
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.
Tim Holloway wrote:JSF is based on HTML and HTML has a fundamental limitation that exactly one and only one form can be submitted per request.
Don't worry about the form being too big. JSF uses POST, and that means that in effect the form data being uploaded looks like this:
Not much overhead there. Yes, the server can be set up to restrict how many bytes of data are acceptable, but these days, that would be a form so complex that the users would gouge their eyeballs out just trying to read it.
AJAX can be used to restrict the uploaded data from that form to a small subset, which minimizes overhead.
SCJP, SCWCD
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.
And tomorrow is the circus! We can go to the circus! I love the circus! We can take this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
|