...

View Full Version : Triggering a link from a function and form validation



escaperanger
05-09-2004, 09:06 PM
I am hoping someone can assist me with a part of the form validation I am working on. Here's an overview.

The user fills out a form.
The user clicks the submit button.
The form's onsubmit handler calls a function to validate the form.
If there are fields missing values, the function alerts the user with a message.
The user clicks 'OK' in the alert box.
The function returns false.
The form is not submitted.

Then I would like the page to jump to an anchor located at the top of the form.

How do I make the page move to the anchor from within the function that was called?


Thanks for the assistance.

escaperanger
05-09-2004, 10:42 PM
Here's one solution that almost fits the bill.

form.element.focus()

Gives the missing form element focus and (in some browsers) moves the page to that element.

I would still prefer to be returned to the top of the form. If anyone has an idea I would appreciate the help.

Thanks

Willy Duitt
05-10-2004, 12:17 AM
Then use an anchor an give that focus

escaperanger
05-10-2004, 01:15 AM
good idea. i'll try it. thanks!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum