first form is ignored, second form is forms[0] why?

Discussion in 'Javascript' started by groups2@reenie.org, Aug 4, 2007.

  1. Guest

    Does anyone recognize this situation and know what causes it ?

    The page starts with just a search form. When you do a search the page
    now has a search results form, a save botton, and the search form at
    the bottom. There is also a link to add another form with a
    dropdown. If you add the third form the page has the search results
    form, the form with the dropdown and the search form, in that order.

    The save button is set to submit the search results, which is always
    forms[0]. If the page has all 3 forms, it works fine. The first form
    is submitted,and it is the correct form. If however, the page only has
    2 forms, the search results form is ignored, and the form submitted as
    forms[0] is the second form, the search form.

    document.forms.length is 2 so there does indeed seem to be 2 forms.
    What happened to the first form ? Why is it being ignored.
     
    , Aug 4, 2007
    #1
    1. Advertising

  2. Rik Guest

    On Sat, 04 Aug 2007 23:17:18 +0200, <> wrote:

    > Does anyone recognize this situation and know what causes it ?
    >
    > The page starts with just a search form. When you do a search the page
    > now has a search results form, a save botton, and the search form at
    > the bottom. There is also a link to add another form with a
    > dropdown. If you add the third form the page has the search results
    > form, the form with the dropdown and the search form, in that order.
    >
    > The save button is set to submit the search results, which is always
    > forms[0]. If the page has all 3 forms, it works fine. The first form
    > is submitted,and it is the correct form. If however, the page only has
    > 2 forms, the search results form is ignored, and the form submitted as
    > forms[0] is the second form, the search form.
    >
    > document.forms.length is 2 so there does indeed seem to be 2 forms.
    > What happened to the first form ? Why is it being ignored.
    >


    Source/URL?

    --
    Rik Wasmus
     
    Rik, Aug 4, 2007
    #2
    1. Advertising

  3. Guest

    On Aug 4, 6:02 pm, Rik <> wrote:
    > On Sat, 04 Aug 2007 23:17:18 +0200, <> wrote:
    > > Does anyone recognize this situation and know what causes it ?

    >
    > > The page starts with just a search form. When you do a search the page
    > > now has a search results form, a save botton, and the search form at
    > > the bottom. There is also a link to add another form with a
    > > dropdown. If you add the third form the page has the search results
    > > form, the form with the dropdown and the search form, in that order.

    >
    > > The save button is set to submit the search results, which is always
    > > forms[0]. If the page has all 3 forms, it works fine. The first form
    > > is submitted,and it is the correct form. If however, the page only has
    > > 2 forms, the search results form is ignored, and the form submitted as
    > > forms[0] is the second form, the search form.

    >
    > > document.forms.length is 2 so there does indeed seem to be 2 forms.
    > > What happened to the first form ? Why is it being ignored.

    >
    > Source/URL?
    >
    > --
    > Rik Wasmus


    Sorry, I can't post the url. I have tried but I am not able to make a
    simple test case. Every time I do it works fine.
     
    , Aug 4, 2007
    #3
  4. wrote:
    > On Aug 4, 6:02 pm, Rik <> wrote:
    >> On Sat, 04 Aug 2007 23:17:18 +0200, <> wrote:
    >>> [...]
    >>> document.forms.length is 2 so there does indeed seem to be 2 forms.
    >>> What happened to the first form ? Why is it being ignored.

    >> Source/URL?
    >> [...]

    >
    > Sorry, I can't post the url. I have tried but I am not able to make a
    > simple test case. Every time I do it works fine.


    Certainly you can provide the full source of your HTML document using a
    public URI. If not, you have to try the http://validator.w3.org/ yourself.
    This is likely not to be a script issue but a case of invalid markup.

    Please quote only the minimum of what you are replying to in order to retain
    the context of your reply.


    PointedEars
    --
    Anyone who slaps a 'this page is best viewed with Browser X' label on
    a Web page appears to be yearning for the bad old days, before the Web,
    when you had very little chance of reading a document written on another
    computer, another word processor, or another network. -- Tim Berners-Lee
     
    Thomas 'PointedEars' Lahn, Aug 4, 2007
    #4
  5. Evertjan. Guest

    wrote on 05 aug 2007 in comp.lang.javascript:

    > On Aug 4, 6:02 pm, Rik <> wrote:
    >> On Sat, 04 Aug 2007 23:17:18 +0200, <> wrote:
    >> > Does anyone recognize this situation and know what causes it ?

    >>
    >> > The page starts with just a search form. When you do a search the page
    >> > now has a search results form, a save botton, and the search form at
    >> > the bottom. There is also a link to add another form with a
    >> > dropdown. If you add the third form the page has the search results
    >> > form, the form with the dropdown and the search form, in that order.

    >>
    >> > The save button is set to submit the search results, which is always
    >> > forms[0]. If the page has all 3 forms, it works fine. The first form
    >> > is submitted,and it is the correct form. If however, the page only has
    >> > 2 forms, the search results form is ignored, and the form submitted as
    >> > forms[0] is the second form, the search form.

    >>
    >> > document.forms.length is 2 so there does indeed seem to be 2 forms.
    >> > What happened to the first form ? Why is it being ignored.

    >>
    >> Source/URL?

    >
    > Sorry, I can't post the url. I have tried but I am not able to make a
    > simple test case. Every time I do it works fine.


    Ah, the dreaded borderline effect!

    The only effect in javascriptingdom where neither John nor Randy has found
    a cure for.

    The only solution seems not to make a simple test case, so it won't work
    fine every time.

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
     
    Evertjan., Aug 4, 2007
    #5
  6. Guest


    >
    > Ah, the dreaded borderline effect!
    >
    > The only effect in javascriptingdom where neither John nor Randy has found
    > a cure for.
    >
    > The only solution seems not to make a simple test case, so it won't work
    > fine every time.
    >
    > --
    > Evertjan.
    > The Netherlands.
    > (Please change the x'es to dots in my emailaddress)


    I figured out the problem. The second form was recontructed depending
    on what was posted. The contents of the div that contained the second
    form was first deleted and then a query string was constructed based
    on the form number of the form that no longer existed.
    I took out the line that deleted the form. It doesn't seem neccesary,
    since the form is going to be rewritten anyway a millesecond later.
     
    , Aug 5, 2007
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?YzY3NjIyOA==?=

    how to pass value from first form to second form?

    =?Utf-8?B?YzY3NjIyOA==?=, Jan 11, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    879
    =?Utf-8?B?YzY3NjIyOA==?=
    Jan 11, 2006
  2. Hywel Jenkins
    Replies:
    1
    Views:
    321
    perseus
    Aug 7, 2003
  3. vbnetguy
    Replies:
    1
    Views:
    463
    msnews.microsoft.com
    Jul 25, 2006
  4. Mr. SweatyFinger
    Replies:
    2
    Views:
    1,994
    Smokey Grindel
    Dec 2, 2006
  5. Mark Sizzler
    Replies:
    9
    Views:
    370
    Jan Thomä
    Apr 22, 2009
Loading...

Share This Page