• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Referencing A Form Inside Of A Form

 
Ranch Hand
Posts: 240
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?

 
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Luke Shannon
Ranch Hand
Posts: 240
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You try anchors links or
this JavaScript

Eric
 
Luke Shannon
Ranch Hand
Posts: 240
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

ie: www.page.com#link1 (but the page doesn't actually shift down to link1).



Perhaps you are not declaring the anchor correctly?
 
Luke Shannon
Ranch Hand
Posts: 240
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is little table of contents:



Here is the section 4 declaration:



Is this not correct?

Luke
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<a href="section4">Section 4</a><br>

Should be:

<a name="section4">Section 4</a><br>
 
Luke Shannon
Ranch Hand
Posts: 240
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That was it. Thanks for the help guys.

Luke
 
No one can make you feel inferior without your consent - Eleanor Roosevelt. tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic