| Author |
Referencing A Form Inside Of A Form
|
Luke Shannon
Ranch Hand
Joined: Sep 30, 2004
Posts: 239
|
|
I have a very large form (Form A). I am trying to build a navigation system that would allow you to jump to sections in the form. My little navigation system is form based (Form B) and the javascript function it calls can't seem to reference the Form B. But if I move Form B outside of Form A it works fine. Here are some code samples. My plan was to duplicate Form B through out the lengthy Form A allowing users to jump around while they fill it out. Will this work? Is there another way to do this? Here is the navigation form to be imbedded inside the large form. Here is the javascript the form above submits too. The error I get is document.B is not an object. But it works fine if Form B is not inside of another form. I am guessing the way I reference the embedded form needs to change. But is there a way to do it?
|
Luke
SCJP
|
 |
Andrew Eccleston
Ranch Hand
Joined: Jul 07, 2004
Posts: 140
|
|
|
Forms should not be nested within other forms. XHTML specifically forbids this. I can't seem to find details on nesting forms in the HTML 4.01 spec, but it's something you should avoid.
|
The statement below is true.<br />-------------------------------<br />The statement above is false.
|
 |
Luke Shannon
Ranch Hand
Joined: Sep 30, 2004
Posts: 239
|
|
I wonder if there is another way to do this? Anyone have an ideas of how I could have users be able to jump from one area of the form to another to speed up the filling out of the form? Thanks, Luke
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
|
|
You try anchors links or this JavaScript Eric
|
 |
Luke Shannon
Ranch Hand
Joined: Sep 30, 2004
Posts: 239
|
|
I tried anchors. For some reason the page doesn't "jump" to the correct location, although the url get modified accordingly (it is a JSP page, don't know if that has anything to do with it). ie: www.page.com#link1 (but the page doesn't actually shift down to link1). I will try playing with your script a bit. I want a table of contents that I can put through out the page. I should be able to call your script from a <a> tag using the onClick method. If I give another <a> an id on the page I think you script should be able to get the position if I pass in the id of the element I can to scroll too. I will try this all out in a little bit. Luke
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56153
|
|
Perhaps you are not declaring the anchor correctly?
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Luke Shannon
Ranch Hand
Joined: Sep 30, 2004
Posts: 239
|
|
Here is little table of contents: Here is the section 4 declaration: Is this not correct? Luke
|
 |
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
|
|
<a href="section4">Section 4</a><br> Should be: <a name="section4">Section 4</a><br>
|
 |
Luke Shannon
Ranch Hand
Joined: Sep 30, 2004
Posts: 239
|
|
That was it. Thanks for the help guys. Luke
|
 |
 |
|
|
subject: Referencing A Form Inside Of A Form
|
|
|