Ergebnis 1 bis 5 von 5
-
20-01-2006, 07:24 #1
Grünschnabel
- registriert
- 20-01-2006
- Beiträge
- 4
Dynamische Dropdown Menus - Submit() Problem!
moin, moin,
hab dynamisches Dropdown bestehend aus drei ListMenues gebaut, Beispiel Autos:
1. List: Firmen (VW, Audi, etc.), 2. List Modelle (dynamisch), dann einen Löschen und Hinzufügen Button (nicht submit), so dass ich die jeweilige Auswahl in die 3.List kriege.
Funktioniert wunderbar!
Jetzt bemühe ich mich die Auswahl aus der 3. List per form post an test.php zu schicken, um da die entsprechenden Formularwerte mit $_POST['xyz'] wie immer auszulesen, aber irgendwie kommt da nichts an.
Das Formular ist stinknormal:
<form action="test.php" method="post" enctype="multipart/form-data" name="cars" id="cars">
Das 3. ListMenu heisst Target, hab nen Mini-Script geschrieben, zum Test:
<SCRIPT LANGUAGE="JavaScript">
<!--
function testResults (form) {
var TestVar = cars.Target.value;
alert ("Jetzt aber...: " + TestVar);
}
//-->
</SCRIPT>
... meldet aber auch nichts als gar nichts, vielleicht habt ihr ja ne Idee, wie ich die Daten aus der TargetList auf ne andere Seite bekomme,
1000 Dank, mil
-
20-01-2006, 07:48 #2pit-r Guest
AW: Dynamische Dropdown Menus - Submit() Problem!
Moin!
In Deiner Funktion muß es 'var TestVar = document.cars.Target.value;' heißen. Stellt sich noch die Frage: wie rufst Du die Funktion auf und wo/ wie findet der submit statt, wenn Du keinen submit-Button hast?
Ahoi - Pit
-
20-01-2006, 09:29 #3
Grünschnabel
- registriert
- 20-01-2006
- Beiträge
- 4
AW: Dynamische Dropdown Menus - Submit() Problem!
Danke für die Rückmeldung - Funktion korrigiert - trotzdem keine Werte - grmpf.
Submit Button hab ich natürlich installiert (vergessen zu sagen) - auch stinknormal:
<input name="Go" type="submit" class="ButtonCMSDD" id="Go" value="Fertig!" onSubmit()" />
Vielleicht hilft es, wenn ich mal das Dropdown script poste (ist nen bisserl lang):Code:<script type="text/JavaScript"> <!-- function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function WA_AddValueToList(ListObj,TextString,ValString,Position) { if (isNaN(parseInt(Position))) { Position = ListObj.options.length; } else { Position = parseInt(Position); } if (ListObj.length > Position) { ListObj.options[Position].text=TextString; if (ValString != "") { ListObj.options[Position].value = ValString; } else { ListObj.options[Position].value=TextString; } } else { var LastOption = new Option(); var OptionPosition = ListObj.options.length; ListObj.options[OptionPosition] = LastOption; ListObj.options[OptionPosition].text = TextString; if (ValString != "") { ListObj.options[OptionPosition].value = ValString; } else { ListObj.options[OptionPosition].value=TextString; } } } function WA_subAwithBinC(a,b,c) { var i = c.indexOf(a); var l = b.length; while (i != -1) { c = c.substring(0,i) + b + c.substring(i + a.length,c.length); //replace all valid a values with b values in the selected string c. i += l i = c.indexOf(a,i); } return c; } function WA_AddSubToSelected(sublist,targetlist,repeatvalues,leavetop,leavebottom,noseltop,noselbot,topval,toptext) { for (var j=0; j<noseltop; j++) { sublist.options[j].selected = false; } for (var k=0; k<noselbot; k++) { sublist.options[sublist.options.length-(k+1)].selected = false; } if (sublist.selectedIndex >= 0) { if (leavebottom) { botrec = new Array(2); if (targetlist.options.length > 0) { botrec[0] = targetlist.options[targetlist.options.length-1].value; botrec[1] = targetlist.options[targetlist.options.length-1].text; targetlist.options[targetlist.options.length-1] = null; } } if (!leavetop && targetlist.options.length > 0) { if (targetlist.options[0].value == topval) { targetlist.options[0] = null; } } else { if (leavetop && toptext != '') { targetlist.options[0] = new Option(); targetlist.options[0].value = topval; targetlist.options[0].text = toptext; } } for (var o=0; o<sublist.options.length; o++) { if (sublist.options[o].selected && o >= noseltop && o < sublist.options.length - noselbot) { theText = sublist.options[o].text; theValue = sublist.options[o].value; addvalue = true; if (!repeatvalues) { for (var p=0; p<targetlist.options.length; p++) { if (theValue == targetlist.options[p].value) { addvalue = false; } } } if (addvalue) WA_AddValueToList(targetlist,theText,theValue,targetlist.options.length); } } if (leavebottom && botrec[1]) { WA_AddValueToList(targetlist,botrec[1],botrec[0],targetlist.options.length); } } for (var l=0; l < targetlist.options.length; l++) { targetlist.options[l].selected = false; } } function WA_RemoveSelectedFromList(theBox,nottoremove,noneselectedoption,noneselectedvalue,noneselectedtext) { var n=0; var selectedArray = new Array(); for (var j=0; j<theBox.options.length; j++) { if (!theBox.options[j].selected || nottoremove.indexOf("|WA|" + theBox.options[j].value + "|WA|") >= 0) { theBox.options[n].value = theBox.options[j].value; theBox.options[n].text = theBox.options[j].text; n++; } else { selectedArray[selectedArray.length] = j; } } for (var k=0; k<selectedArray.length; k++) { theBox.options[selectedArray[k]].selected = false; } m = n; while (m<=j) { theBox.options[n] = null; m++; } if (theBox.options.length == noneselectedoption && noneselectedtext != "") { noneselectedvalue = WA_subAwithBinC("|WA|",",",noneselectedvalue); noneselectedtext = WA_subAwithBinC("|WA|",",",noneselectedtext); WA_AddValueToList(theBox,noneselectedtext,noneselectedvalue,0); } for (var l=0; l < theBox.options.length; l++) { theBox.options[l].selected = false; } } function WA_SelectAllInTarget(boxtoselect, valstonotselect) { for (var x=0; x<boxtoselect.options.length; x++) { if (valstonotselect.indexOf("|WA|" + boxtoselect.options[x].value + "|WA|") < 0) { boxtoselect.options[x].selected = true; } else { boxtoselect.options[x].selected = false; } } } function WA_MoveListOption(sourceselect,optionIndex,moveAdder) { var oldvals = new Array(sourceselect.options[optionIndex + moveAdder].value, sourceselect.options[optionIndex + moveAdder].text, sourceselect.options[optionIndex + moveAdder].selected); sourceselect.options[optionIndex+moveAdder].value = sourceselect.options[optionIndex].value; sourceselect.options[optionIndex+moveAdder].text = sourceselect.options[optionIndex].text; sourceselect.options[optionIndex+moveAdder].selected = sourceselect.options[optionIndex].selected; sourceselect.options[optionIndex].value = oldvals[0]; sourceselect.options[optionIndex].text = oldvals[1]; sourceselect.options[optionIndex].selected = oldvals[2]; } function WA_MoveSelectedInList(sourceselect,tomove,topnum,botnum) { if (tomove == "0") { for (var n=topnum+1; n<sourceselect.options.length-botnum; n++) { if (sourceselect.options[n].selected && !sourceselect.options[n-1].selected) { WA_MoveListOption(sourceselect,n,-1); } } } else { for (var n=(sourceselect.options.length-botnum)-2; n>=topnum; n--) { if (sourceselect.options[n].selected && !sourceselect.options[n+1].selected) { WA_MoveListOption(sourceselect,n,1); } } } } function WA_ClientSideReplace(theval,findvar,repvar) { var retval = ""; while (theval.indexOf(findvar) >= 0) { retval += theval.substring(0,theval.indexOf(findvar)); retval += repvar; theval = theval.substring(theval.indexOf(findvar) + String(findvar).length); } retval += theval; if (retval == "" && theval.indexOf(findvar) < 0) { retval = theval; } return retval; } function WA_UnloadList(thelist,leavevals,bottomnum) { while (thelist.options.length > leavevals+bottomnum) { if (thelist.options[leavevals]) { thelist.options[leavevals] = null; } } return leavevals; } function WA_FilterAndPopulateSubList(thearray,sourceselect,targetselect,leaveval,bottomleave,usesource,delimiter) { if (bottomleave > 0) { leaveArray = new Array(bottomleave); if (targetselect.options.length >= bottomleave) { for (var m=0; m<bottomleave; m++) { leavetext = targetselect.options[(targetselect.options.length - bottomleave + m)].text; leavevalue = targetselect.options[(targetselect.options.length - bottomleave + m)].value; leaveArray[m] = new Array(leavevalue,leavetext); } } else { for (var m=0; m<bottomleave; m++) { leavetext = ""; leavevalue = ""; leaveArray[m] = new Array(leavevalue,leavetext); } } } startid = WA_UnloadList(targetselect,leaveval,0); mainids = new Array(); if (usesource) maintext = new Array(); for (var j=0; j<sourceselect.options.length; j++) { if (sourceselect.options[j].selected) { mainids[mainids.length] = sourceselect.options[j].value; if (usesource) maintext[maintext.length] = sourceselect.options[j].text + delimiter; } } for (var i=0; i<thearray.length; i++) { goodid = false; for (var h=0; h<mainids.length; h++) { if (thearray[i][0] == mainids[h]) { goodid = true; break; } } if (goodid) { theBox = targetselect; theLength = parseInt(theBox.options.length); theServices = thearray[i].length + startid; var l=1; for (var k=startid; k<theServices; k++) { if (l == thearray[i].length) break; theBox.options[k] = new Option(); theBox.options[k].value = thearray[i][l][0]; if (usesource) theBox.options[k].text = maintext[h] + WA_ClientSideReplace(thearray[i][l][1],"|WA|","'"); else theBox.options[k].text = WA_ClientSideReplace(thearray[i][l][1],"|WA|","'"); l++; } startid = k; } } if (bottomleave > 0) { for (var n=0; n<leaveArray.length; n++) { targetselect.options[startid+n] = new Option(); targetselect.options[startid+n].value = leaveArray[n][0]; targetselect.options[startid+n].text = leaveArray[n][1]; } } for (var l=0; l < targetselect.options.length; l++) { targetselect.options[l].selected = false; } if (targetselect.options.length > 0) { targetselect.options[0].selected = true; } } //--> </script>
1. List: Brand
2. List: Device (dynamisch)
3. List: Target (Auswahl)
Jetzt ne Idee?
Thx, milGeändert von pit-r (20-01-2006 um 09:31 Uhr) Grund: Rattenschwanz gekürzt...
-
20-01-2006, 09:41 #4pit-r Guest
AW: Dynamische Dropdown Menus - Submit() Problem!
Zitat von _mil28
Ahoi - Pit
-
20-01-2006, 20:50 #5
Grünschnabel
- registriert
- 20-01-2006
- Beiträge
- 4
AW: Dynamische Dropdown Menus - Submit() Problem!
Wird gemacht, das ist mein Formular:
<form action="test.php" method="post" enctype="multipart/form-data" name="cars" id="cars">
// 1.List
<select name="Brand" size="25" multiple="multiple" class="List140pxCMSDD" id="Brand" onchange= "WA_FilterAndPopulateSubList(rsDevice_WAJA,MM_findObj('Brand'),MM_findObj('Device'),1,0,false,': ')">
<option value="Opel">Opel</option>
</select>
// 2.List (dynamisch)
<select name="Device" size="25" multiple="multiple" class="List140pxCMSDD" id="Device">
<option>Modelle:</option> // Statischer Ersteintrag
</select>
// 3. List (Auswahl)
<select name="Target" size="25" multiple="multiple" class="List140pxCMSDD" id="Target">
<option>Auswahl:</option> // Statischer Ersteintrag
</select>
<input name="Go" type="submit" class="ButtonCMSDD" id="Go" value="" onClick()/>
</form>
Ähnliche Themen
-
validierung bzw. submit problem
Von ewisches im Forum JavaScriptAntworten: 7Letzter Beitrag: 29-12-2005, 16:42 -
Problem mit Java DropDown Menus bei Opera/Mozilla/Netscape
Von s7orm im Forum JavaScriptAntworten: 3Letzter Beitrag: 14-02-2005, 15:29 -
Rießen Problem mit Formularen und Submit
Von Rebell im Forum JavaScriptAntworten: 1Letzter Beitrag: 21-10-2004, 10:54 -
Problem mit submit
Von Denow im Forum JavaScriptAntworten: 30Letzter Beitrag: 06-07-2003, 12:24 -
Nettes Problem mit Formular submit....
Von style-guide! im Forum JavaScriptAntworten: 7Letzter Beitrag: 30-10-2002, 15:55
Lesezeichen