Click to See Complete Forum and Search --> : Two forms on one page


hammerslane
01-30-2004, 09:28 AM
Hi, I have a site structure where I call up a header.inc and footer.inc to every one of my pages in my site. In the header, is a search box form thing. In one of the pages, the body content also has a form (a contact form).

When I submit the contact form, the page submits to the first <form action="search.pl"> (search form).

I heard a crazy rumour that on one submit button you can use a javascript onclick, and on the other you can do a normal type=submit... but I don't know if it'd work, or how to do it.

Is what I'm trying to do, possible?

Cheers!

banpro
01-30-2004, 11:14 AM
hammerslane, under normal conditions you should have no problem running 2 forms from a single page. Often when a customer of mine has this problem it's due to them forgetting the </form> tag after their submit button on the first form.

Another thing to check is are your forms named? ie. <form method=*** action=**** name="Some Name">

Use the name value in your form tags, and make sure that you don't use the same name on both forms.

Also, yes you can use a javascript onclick for one or both of your forms as well. I don't have any snippets handy but a quick search should produce examples for you.

HTH,
Scott

maverik_30
02-09-2004, 08:10 PM
You may want to check the nesting of the forms. you can't nest one form inside another form.

Ben Rogers
02-09-2004, 08:23 PM
er... don't use name.

banpro, im dissapointed in you, reccomending deprecated attributes...

IncaWarrior
02-09-2004, 08:27 PM
<form action="actionhere" id="name here">

Ben Rogers
02-09-2004, 08:32 PM
better, but i dont think u need either, unless your styling with CSS.

Just be sure to close all the tages and you should be fine.

Yea, and a link..?

Paul Jr
02-09-2004, 11:01 PM
Originally posted by omega
er... don't use name.

banpro, im dissapointed in you, reccomending deprecated tags...
I believe that would be Deprecated attributes. ;)

Ben Rogers
02-10-2004, 03:05 PM
um.. thats what i said.... i just added in that edited text for looks. :rolleyes:

hammerslane
02-11-2004, 02:45 AM
Originally posted by omega
Yeah, and a link..? sorry about not replying... but my website is having a non-explained week of down time :(
i'll test it and post teh link here as soon as the site starts showing up

thanks for all the replies too. :)

Ben Rogers
02-11-2004, 06:47 PM
ok.