File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes Form at the bottom of the page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Form at the bottom of the page" Watch "Form at the bottom of the page" New topic

Form at the bottom of the page

Zhomart Sadyakas

Joined: Apr 13, 2011
Posts: 10
I have form at the bottom of the page, I don't want user after pressing "Enter" scroll all the way down to the bottom to see errors/correct input. Is there way to specify somehow fragment in URL, like "#someFormId".
It's possible to specify it for a <h:link> with "fragment" attribute, but I couldn't find anything on form's, form's commandButtons or wherever.
Nobody has forms anywhere except top of the page?
Zhomart Sadyakas

Joined: Apr 13, 2011
Posts: 10
One more related thing, is:
Suppose we have some kind of "quick" form, which popups or at some corner of the page, if user fills in some data and press submit button, then whenever error raised he would be redirected to "dedicated" page for this form, with all the errors shown there.
Is it possible ?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17410

I think you could code a JavaScript onload() function that would jump to a designated anchor link on the page. Normally you would be putting important stuff at the top of the page, so the first time in, at least, you'd usually want to be at the top of the page.

If you use AJAX to process the form, the page can update in place, so the user can be scrolled anywhere without having the browser jump to the top of the page.

For a non-AJAX approach it probably is better to just put the form on its own page, at the top of the page.

Actual use of the HTML "#" anchor indicator in JSF doesn't work, because JSF uses it internally.

I do have some pop-up dialogs done with RichFaces, and since they use the JSF error message facility, when the popup goes away, the error is visible in the error display on the page that hosts the dialog box.

Having said all that, I should remark that one of the advantages of JSF is that it makes it easy to put error messages close to the input controls that have the errors in them, so scrolling and such over messages isn't really all that important.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: Form at the bottom of the page
It's not a secret anymore!