Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > first form is ignored, second form is forms[0] why?

Reply
Thread Tools

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

 
 
groups2@reenie.org
Guest
Posts: n/a
 
      08-04-2007
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.

 
Reply With Quote
 
 
 
 
Rik
Guest
Posts: n/a
 
      08-04-2007
On Sat, 04 Aug 2007 23:17:18 +0200, <(E-Mail Removed)> 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
 
Reply With Quote
 
 
 
 
groups2@reenie.org
Guest
Posts: n/a
 
      08-04-2007
On Aug 4, 6:02 pm, Rik <(E-Mail Removed)> wrote:
> On Sat, 04 Aug 2007 23:17:18 +0200, <(E-Mail Removed)> 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.

 
Reply With Quote
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      08-04-2007
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> On Aug 4, 6:02 pm, Rik <(E-Mail Removed)> wrote:
>> On Sat, 04 Aug 2007 23:17:18 +0200, <(E-Mail Removed)> 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
 
Reply With Quote
 
Evertjan.
Guest
Posts: n/a
 
      08-04-2007
wrote on 05 aug 2007 in comp.lang.javascript:

> On Aug 4, 6:02 pm, Rik <(E-Mail Removed)> wrote:
>> On Sat, 04 Aug 2007 23:17:18 +0200, <(E-Mail Removed)> 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)
 
Reply With Quote
 
groups2@reenie.org
Guest
Posts: n/a
 
      08-05-2007

>
> 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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
strip all but second second line from bottom and then strip that!!!! yelipolok Perl Misc 4 01-27-2010 08:14 AM
Button OnClick does not fire on first postback, but does on second Janet Collins ASP .Net 0 01-13-2006 10:08 PM
how to pass value from first form to second form? =?Utf-8?B?YzY3NjIyOA==?= ASP .Net 2 01-11-2006 11:15 PM
Can I have a second TRY inside the first TRY/CATCH in ASP.NET ??? bienwell ASP .Net 4 05-27-2005 05:05 PM
Datalist selects Item after first click, but does apply the SelectedItemTemplate after the second click only Dirk Meusel ASP .Net 1 08-19-2003 09:56 AM



Advertisments