[phpBB Debug] PHP Notice: in file /includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
www.dhtmlgoodies.com • View topic - Multiple forms in page problem
Page 1 of 1

Multiple forms in page problem

PostPosted: Sat Feb 11, 2006 6:39 pm
by Tanushiheadbash
I wonder if you could point me to the answer here- its obviously something I am doing wrong with your code. I don't know javascript at all so am a bit perplexed- I thought I had it sussed but then hit another issue!

I have a php page from which I can submit queries to a database, and I want to use your calendar script to allow the date picking for the queries. My page however has four separate forms on and I want to use your date chooser on two fields each in the third and fourth form- Each form queries a different page. I can't get it working. I tried building up the page from scratch to help me debug my problem

With one form on a page your script runs fine.

With two forms I run into a problem when I click the calendar button- I get a script error in the browser that says Line:746
CHar 2
Error: 'value' is null or not an object
Code 0
I seemed to get round this as I noticed there is a line in the code that hangs with the selection box of "document.forms[0]" I edited this in the second form to read document.forms[1] and this seemd to sort the problem, all four selection buttons now worked (two in each form)

I then added the last bits of php code to my page - two further forms which are used for refreshing some queries run within the same page, they don't have date fields- These two forms are ahead of the two forms with your javascript calendars in:

So I have
<form 3> with 2 calander pop ups
<form 4> with 2 calander pop ups
Making sense?

With this config I get the script error again and nothing I do seems to fix it, renumbering the form - is it an object you call it?

Whts the solution- I bet its simple but I can't work it out? Thanks for a great script- I have made use of it in other single form pages with no problems at all!


Duh! forget it found the problem

PostPosted: Sat Feb 11, 2006 6:43 pm
by Tanushiheadbash
I had no sooner submitted the post than came across what I had done wrong! Eejit that I am

As I built up the forms and code I renumbered the document.forms[x] objects 3 and 4 ( in the 3rd and 4th forms, but then I noticed it should have been [2] and [3] as I take it the values of the objects starts from 0 .)

Sorry for troubling you- maybe this post will be useful for other Javascript newbies!


PostPosted: Sat Feb 11, 2006 7:21 pm
by Batalf
Hello Kenny and welcome to the forum!!

I'm glad you worked it out.:D

PostPosted: Sun Oct 07, 2007 12:05 am
by guest