Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Form at the bottom of the page

 
Zhomart Sadyakas
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 18014
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic