HighDots Forums  

submitting multiple forms with single button

Macromedia Dreamweaver Macromedia Dreamweaver Discussions (macromedia.dreamweaver)


Discuss submitting multiple forms with single button in the Macromedia Dreamweaver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Izzyg33 webforumsuser@macromedia.com
 
Posts: n/a

Default submitting multiple forms with single button - 01-13-2004 , 10:12 AM






Hi

I need to submit 3 forms on one page with one submit button. I need to use the get method to pass values acoss to the next page. Is this possible & how is it done?

Thanks




Reply With Quote
  #2  
Old   
Julian Roberts
 
Posts: n/a

Default Re: submitting multiple forms with single button - 01-13-2004 , 10:30 AM






Can't be done. Put everything into 1 form.

--
Jules
http://www.charon.co.uk/charoncart
Charon Cart 3
Shopping Cart Extension for Dreamweaver MX/MX 2004




Reply With Quote
  #3  
Old   
mrichmond webforumsuser@macromedia.com
 
Posts: n/a

Default Re: submitting multiple forms with single button - 01-13-2004 , 11:30 AM



No it is not possible.

Only one form can be submitted per page.

You can make it look like 3 forms on the page to the viewer, but in the code it needs to be only 1 form. The submit button will submit the form that it is contained in.


Hope that helps.




--Megan Richmond

Reply With Quote
  #4  
Old   
Izzyg33 webforumsuser@macromedia.com
 
Posts: n/a

Default Re: submitting multiple forms with single button - 01-14-2004 , 09:17 AM



Ok

maybe you can help with the problem

Ive got a form and the first two field are drop-down menus where the second menus
values change according to what was selected in the first menu. The only script I
could find to do this is one where the two drop-down menus are put into their own
form tags because of the way the javascript is written. That is why I needed to
submit 3 forms with one button, the two forms for the drop-down menus and the main
form. You can see this at http://www.izzyglanville.co.uk/join_now_2.php

Do you know of a similar script that doesn't put the drop-down menus into form tags?

or

Can you tell me how to edit the javascript to take the drop-down menus out of the
form tags??

Heres the script;

Head Script;

<SCRIPT language=JavaScript>
<!--
/*
// GENERATED BY MENUGEN located at http://www.supertom.com/menugen/
// Menugen Copyright 2000 Tom Melendez
// Universal Related Select Menus - cascading popdown menus
// by Andrew King. v1.34 19990720
// Copyright (c) 1999 internet.com LLC. All Rights Reserved.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Originally published and documented at http://www.webreference.com
// Contact aking (AT) internet (DOT) com for all other uses.
//
// Change History
// 3-3-96 code optimized, modularized, and made universal-abk
// 3-8-97 jumpPage1 and 2 consolidated into generalized func
// 3-10-97 changeMenu added jumpPage(0,0), for non-ns3 browsers
// make popup act like a live popup when no related functionality
// 8-5-97 browser detect script changed to check for option functionality
// 9-11-97 aln changed to options.length, as IE 4 does not support
// nulling out options
// 12-22-98 added SIZE att to make select lists, used named forms/elements
// 1-1-99 added getFormNum to fix netscape 2 bug (doesn't support named fms)
// pass formName, elementNum to relate and jmp as workaround
// pass this.form,0 and increment instead of decrement in relate to get
// next form
// assumes menu2 follows menu1 in HTML
// tested in mac ie3.01/ns2.02 (live), ns 3.01,4.05,4.5 and ie4.01 related
// 990204 - adopted a more modular/oo approach using two D arrays, thanks
// to Jacob Berner <leo7278 (AT) hotmail (DOT) com> for his input
// 990701 - fixed back button bug in ie4+ by resetting all forms onload-abk
// thanks to peter belesis (pbel (AT) internet (DOT) com) for this fix
// 990714 - added IE5 persistence - abk pb
// 990715 - went open source, created stripped down example files - abk
// 990720 - jmp() fix getFormNum(formName);->
// var formNum = getFormNum(formName);
// if (v) {..} added around newCat array creation for old browsers
// 990721 - getFormNum/relate tweaks, unnec code removed,
// ns2.0 mac fix - getFormNum returns -1 in nested tables
// new jmp bypasses prob - thx to thanks to Michael Guitton
// saramaca (AT) mail (DOT) dotcom.fr
// 990722 - var for scope added, jmp chgd to named form for ns2.02 bug-abk
*/
if(v){a=new Array(22);}

function getFormNum (formName) {
var formNum =-1;
for (i=0;i<document.forms.length;i++){
tempForm = document.forms;
if (formName == tempForm) {
formNum = i;
break;
}
}
return formNum;
}

function jmp(form, elt)
// The first parameter is a reference to the form.
{
if (form != null) {
with (form.elements[elt]) {
if (0 <= selectedIndex)
location = options[selectedIndex].value;
}
}
}

var catsIndex = -1;
var itemsIndex;

if (v) { // ns 2 fix
function newCat(){
catsIndex++;
a[catsIndex] = new Array();
itemsIndex = 0;
}

function O(txt,url) {
a[catsIndex][itemsIndex]=new myOptions(txt,url);
itemsIndex++;
}

function myOptions(text,value){
this.text = text;
this.value = value;
}

// fill array here

newCat(); //Full
O("Individual","Individual");
O("Joint Individual","Joint Individual");
O("Company","Company");
newCat(); //Associate
O("Individual","Individual");
O("Company","Company");
// end fill array
} // if (v)



function relate(formName,elementNum,j) {
if(v){
var formNum = getFormNum(formName);
if (formNum>=0) {
formNum++; // reference next form, assume it follows in HTML
with (document.forms[formNum].elements[elementNum]) {
for(i=options.length-1;i>0;i--) options = null; // null out in reverse order (bug workarnd)
for(i=0;i<a[j].length;i++){
options = new Option(a[j].text,a[j].value);
}
options[0].selected = true;
}
}
}
else {
jmp(formName,elementNum);
}
}

// BACK BUTTON FIX for ie4+- or
// MEMORY-CACHE-STORING-ONLY-INDEX-AND-NOT-CONTENT
//
// from peter belesis:
// IE4+ remembers the index of each SELECT but NOT the CONTENTS of each
// SELECT, so it gets it wrong.
//
// it has to do with MEMORY CACHE (where form input is stored) and how
// IE stores information about SELECT menus.
//
// IE stores the selectedINDEX ONLY of the SELECT menu, not the
// CONTENTS-AT-THE-TIME-OF-SELECTION
//
// when we return to a page, it displays the default contents of each
// SELECT, grabs the stored index from cache and aligns the default
// contents to that index.
//
// Netscape, on the other hand, seems to remember both INDEX and CONTENTS
// added ie5 persistence 990714

function IEsetup(){
if(!document.all) return;
IE5 = navigator.appVersion.indexOf("5.")!=-1;
if(!IE5) {
for (i=0;i<document.forms.length;i++) {
document.forms.reset();
}
}
}

window.onload = IEsetup;










Body script

form 1;

<form action=\"join_now_3.php\" method=\"get\" name=\"category\" id=\"category\">
<select class=\"verdana_10pt_grey\" id=\"m1\" name=\"m1\" onchange=\"relate(this.form,0,this.selectedIndex)\ ">
<option value="Full">Full</option>
<option value="Associate">Associate</option>
</select>
</form>

form 2;

<form action="join_now_3.php" method="get" name="type" id="type">
<select class="verdana_10pt_grey" id="m2" name="m2">
<option value="Individual">Individual</option>
<option value="Joint Individual">Joint Individual</option>
<option value="Company">Company</option>
</select>
</form>

Thanks




Reply With Quote
  #5  
Old   
mick_white
 
Posts: n/a

Default Re: submitting multiple forms with single button - 01-14-2004 , 09:26 AM



http://www.mickweb.com/javascript/forms/jumpmenus/tripleOption.html

Mick

"Izzyg33" webforumsuser (AT) macromedia (DOT) com wrote:
Quote:
Ok

maybe you can help with the problem

Ive got a form and the first two field are drop-down menus where the second menus
values change according to what was selected in the first menu. The only script I
could find to do this is one where the two drop-down menus are put into their own
form tags because of the way the javascript is written. That is why I needed to
submit 3 forms with one button, the two forms for the drop-down menus and the main
form. You can see this at http://www.izzyglanville.co.uk/join_now_2.php

Do you know of a similar script that doesn't put the drop-down menus into form tags?

or

Can you tell me how to edit the javascript to take the drop-down menus out of the
form tags??

Heres the script;

Head Script;

SCRIPT language=JavaScript
!--
/*
// GENERATED BY MENUGEN located at http://www.supertom.com/menugen/
// Menugen Copyright 2000 Tom Melendez
// Universal Related Select Menus - cascading popdown menus
// by Andrew King. v1.34 19990720
// Copyright (c) 1999 internet.com LLC. All Rights Reserved.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Originally published and documented at http://www.webreference.com
// Contact aking (AT) internet (DOT) com for all other uses.
//
// Change History
// 3-3-96 code optimized, modularized, and made universal-abk
// 3-8-97 jumpPage1 and 2 consolidated into generalized func
// 3-10-97 changeMenu added jumpPage(0,0), for non-ns3 browsers
// make popup act like a live popup when no related functionality
// 8-5-97 browser detect script changed to check for option functionality
// 9-11-97 aln changed to options.length, as IE 4 does not support
// nulling out options
// 12-22-98 added SIZE att to make select lists, used named forms/elements
// 1-1-99 added getFormNum to fix netscape 2 bug (doesn't support named fms)
// pass formName, elementNum to relate and jmp as workaround
// pass this.form,0 and increment instead of decrement in relate to get
// next form
// assumes menu2 follows menu1 in HTML
// tested in mac ie3.01/ns2.02 (live), ns 3.01,4.05,4.5 and ie4.01 related
// 990204 - adopted a more modular/oo approach using two D arrays, thanks
// to Jacob Berner <leo7278 (AT) hotmail (DOT) com> for his input
// 990701 - fixed back button bug in ie4+ by resetting all forms onload-abk
// thanks to peter belesis (pbel (AT) internet (DOT) com) for this fix
// 990714 - added IE5 persistence - abk pb
// 990715 - went open source, created stripped down example files - abk
// 990720 - jmp() fix getFormNum(formName);-
// var formNum = getFormNum(formName);
// if (v) {..} added around newCat array creation for old browsers
// 990721 - getFormNum/relate tweaks, unnec code removed,
// ns2.0 mac fix - getFormNum returns -1 in nested tables
// new jmp bypasses prob - thx to thanks to Michael Guitton
// saramaca (AT) mail (DOT) dotcom.fr
// 990722 - var for scope added, jmp chgd to named form for ns2.02 bug-abk
*/
if(v){a=new Array(22);}

function getFormNum (formName) {
var formNum =-1;
for (i=0;i<document.forms.length;i++){
tempForm = document.forms;
if (formName == tempForm) {
formNum = i;
break;
}
}
return formNum;
}

function jmp(form, elt)
// The first parameter is a reference to the form.
{
if (form != null) {
with (form.elements[elt]) {
if (0 <= selectedIndex)
location = options[selectedIndex].value;
}
}
}

var catsIndex = -1;
var itemsIndex;

if (v) { // ns 2 fix
function newCat(){
catsIndex++;
a[catsIndex] = new Array();
itemsIndex = 0;
}

function O(txt,url) {
a[catsIndex][itemsIndex]=new myOptions(txt,url);
itemsIndex++;
}

function myOptions(text,value){
this.text = text;
this.value = value;
}

// fill array here

newCat(); //Full
O("Individual","Individual");
O("Joint Individual","Joint Individual");
O("Company","Company");
newCat(); //Associate
O("Individual","Individual");
O("Company","Company");
// end fill array
} // if (v)



function relate(formName,elementNum,j) {
if(v){
var formNum = getFormNum(formName);
if (formNum>=0) {
formNum++; // reference next form, assume it follows in HTML
with (document.forms[formNum].elements[elementNum]) {
for(i=options.length-1;i>0;i--) options = null; // null out in reverse order (bug workarnd)
for(i=0;i<a[j].length;i++){
options = new Option(a[j].text,a[j].value);
}
options[0].selected = true;
}
}
}
else {
jmp(formName,elementNum);
}
}

// BACK BUTTON FIX for ie4+- or
// MEMORY-CACHE-STORING-ONLY-INDEX-AND-NOT-CONTENT
//
// from peter belesis:
// IE4+ remembers the index of each SELECT but NOT the CONTENTS of each
// SELECT, so it gets it wrong.
//
// it has to do with MEMORY CACHE (where form input is stored) and how
// IE stores information about SELECT menus.
//
// IE stores the selectedINDEX ONLY of the SELECT menu, not the
// CONTENTS-AT-THE-TIME-OF-SELECTION
//
// when we return to a page, it displays the default contents of each
// SELECT, grabs the stored index from cache and aligns the default
// contents to that index.
//
// Netscape, on the other hand, seems to remember both INDEX and CONTENTS
// added ie5 persistence 990714

function IEsetup(){
if(!document.all) return;
IE5 = navigator.appVersion.indexOf("5.")!=-1;
if(!IE5) {
for (i=0;i<document.forms.length;i++) {
document.forms.reset();
}
}
}

window.onload = IEsetup;










Body script

form 1;

form action=\"join_now_3.php\" method=\"get\" name=\"category\" id=\"category\"
select class=\"verdana_10pt_grey\" id=\"m1\" name=\"m1\" onchange=\"relate(this.form,0,this.selectedIndex)\ "
option value="Full">Full</option
option value="Associate">Associate</option
</select
/form

form 2;

form action="join_now_3.php" method="get" name="type" id="type"
select class="verdana_10pt_grey" id="m2" name="m2"
option value="Individual">Individual</option
option value="Joint Individual">Joint Individual</option
option value="Company">Company</option
/select
/form

Thanks





Reply With Quote
Reply




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.