Kontinent Land Auswahl verbessert Ajax

This commit is contained in:
aschwarz
2024-01-25 10:27:11 +01:00
parent 3282e34713
commit 3097670cab
7 changed files with 96 additions and 334 deletions

View File

@ -50,54 +50,26 @@ h1
-->
</style>
<script type='text/javascript' src='ajax.js'></script>
<script src='jquery-3.4.1.min.js'></script>
<script type='text/javascript'>
/************************************************************************************************************
Ajax chained select
Copyright (C) 2006 DTHMLGoodies.com, Alf Magne Kalleland
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Dhtmlgoodies.com., hereby disclaims all copyright interest in this script
written by Alf Magne Kalleland.
Alf Magne Kalleland, 2006
Owner of DHTMLgoodies.com
************************************************************************************************************/
var ajax = new sack();
function getCityList(sel)
{
var countryCode = sel.options[sel.selectedIndex].value;
document.getElementById('dhtmlgoodies_city').options.length = 0; // Empty city select box
if(countryCode.length>0){
ajax.requestFile = 'getSubCat.php?countryCode='+countryCode; // Specifying which file to get
ajax.onCompletion = createCities; // Specify function that will be executed after file has been found
ajax.runAJAX(); // Execute AJAX function
}
function fetch_select(){
var kontinent = document.getElementById('kontinent').options[document.getElementById('kontinent').options.selectedIndex].value;
$.ajax({
type: 'POST',
url: 'get_land.php',
data: {
'function': 'fetch_select',
'kontinent': kontinent
},
success: function(result) { //we got the response
document.getElementById('land').innerHTML=result;
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function createCities()
{
var obj = document.getElementById('dhtmlgoodies_city');
eval(ajax.response); // Executing the response from Ajax as Javascript code
}
</script>
@ -106,7 +78,7 @@ function createCities()
<link rel=\"stylesheet\" href=\"styles_pc.css\" type=\"text/css\">
</head>
<body onload=\"if(document.auswert)document.auswert.dhtmlgoodies_country.focus();if(document.auswert)document.auswert.uberschrift.focus();return false;\">
<body onload='fetch_select();'>
<h2>Fragebogen zum Auslandspraktikum</h2>
<p align='center'>
@ -126,8 +98,8 @@ function createCities()
<tr>
<td colspan='4' style='border-left-style: solid; border-left-width: 2px; border-right-style: solid; border-right-width: 2px; border-top-style: solid; border-top-width: 2px'>
<p style='margin-left: 3px; margin-right: 3px'>
<b>Pers&oul,;nliche Angaben<br>
</b> Deine pers&oul,;nlichen Daten
<b>Pers&ouml;nliche Angaben<br>
</b> Deine pers&ouml;nlichen Daten
werden streng vertraulich behandelt und dienen in erster Linie nur
uns, um dir eventuelle R&uuml;ckfragen zu stellen!
</td>
@ -216,7 +188,7 @@ function createCities()
<td width='82%' colspan='3' style='border-right-style: solid; border-right-width: 2px'>
<p style='margin-left: 3px; margin-right: 3px'>
<input type='checkbox' name='eiver_rueckfr' value='Y'"; if($row_einver['einverst'] == 'Y'){ echo " checked "; } echo">
Ich bin damit einverstanden, dass meine <u>Emailadresse</u> f&uuml;r eventuelle Nachfragen ver&oul,;ffentlicht wird.
Ich bin damit einverstanden, dass meine <u>Emailadresse</u> f&uuml;r eventuelle Nachfragen ver&ouml;ffentlicht wird.
</td>
</tr>
<tr>
@ -251,7 +223,7 @@ function createCities()
$query2 = "SELECT kid, kontinent FROM aesp_kontinent ORDER BY kontinent ASC";
$result2 = $db->query ($query2)
or die ("Cannot execute query");
echo "<select id='dhtmlgoodies_country' name='dhtmlgoodies_country' onchange='getCityList(this)' onfocus='getCityList(this)'>
echo "<select id='kontinent' name='kontinent' onchange='fetch_select();'>
<option value=''>Select</option>";
#echo "<option value='%'";if($row3[kontinent] == '%'){echo " selected";} echo">Alle&nbsp;&nbsp;&nbsp;</option>\n";
while ($row2 = $result2->fetch_array()){
@ -267,7 +239,8 @@ function createCities()
Land </td>
<td width='82%' style='border-right-style: solid; border-right-width: 2px'>
<p style='margin-left: 3px; margin-right: 3px'>
<select id='dhtmlgoodies_city' name='dhtmlgoodies_city'>
<select id='land' name='land'>
</select>
</p>
</td>
</tr>
@ -466,8 +439,8 @@ function createCities()
<input type='radio' value='OPI' name='modul' "; if($row['modul'] == 'OPI'){ echo " checked "; } echo">Organisation, Personal, Informationsverarbeitung,<br>
<input type='radio' value='OV' name='modul' "; if($row['modul'] == 'OV'){ echo " checked "; } echo">Ordnungsverwaltung<br>
<input type='radio' value='LV' name='modul' "; if($row['modul'] == 'LV'){ echo " checked "; } echo">Leistungsverwaltung<br>
<input type='radio' value='WFB' name='modul' "; if($row['modul'] == 'WFB'){ echo " checked "; } echo">Wirtschaft und Finanzen, &oul,;ffentliche Betriebe<br>
<input type='radio' value='KFS' name='modul' "; if($row['modul'] == 'KFS'){ echo " checked "; } echo">Kommunalpolitik, F&uuml;hrung im &oul,;ffentlichen Sektor
<input type='radio' value='WFB' name='modul' "; if($row['modul'] == 'WFB'){ echo " checked "; } echo">Wirtschaft und Finanzen, &ouml;ffentliche Betriebe<br>
<input type='radio' value='KFS' name='modul' "; if($row['modul'] == 'KFS'){ echo " checked "; } echo">Kommunalpolitik, F&uuml;hrung im &ouml;ffentlichen Sektor
</td>
</tr>
@ -665,7 +638,7 @@ function createCities()
<td width='43%' style='border-left-style: solid; border-left-width: 2px'>
<p style='margin-left: 3px; margin-right: 3px'>
Ich habe
etwas dazulernen k&oul,;nnen </td>
etwas dazulernen k&ouml;nnen </td>
<td width='56%' style='border-right-style: solid; border-right-width: 2px'>
<input type='radio' name='dazulernen' value='1'"; if($row['dazulernen'] == '1'){ echo " checked "; } echo">1&nbsp;&nbsp;&nbsp;&nbsp;
@ -815,7 +788,7 @@ function createCities()
<p style='margin-left: 3px; margin-right: 3px'>
<b>Deine abschließenden Worte</b><br>
<span style='font-size: 8pt'>Was du einem
Studenten mit auf den langen Weg ins Ausland geben m&oul,;chtest! Ein
Studenten mit auf den langen Weg ins Ausland geben m&ouml;chtest! Ein
paar gute Tipps vielleicht? <br>
&nbsp;</h1>
</td>
@ -887,8 +860,8 @@ if(!$sql){
}
## Bewerbung ##
$kontinent=$_POST['dhtmlgoodies_country'];
$land=$_POST['dhtmlgoodies_city'];
$kontinent=$_POST['kontinent'];
$land=$_POST['land'];
$stadt=$_POST['stadt'];
$stelle=$_POST['stelle'];
$adresse=$_POST['kontaktadresse'];
@ -1037,7 +1010,7 @@ echo"
<td colspan=\"2\"><br>
<p align=\"center\"><b>Herzlichen Dank!</b>
<br>
Wir m&oul,;chten uns ganz herzlich bei Dir daf&uuml;r bedanken, dass Du die M&uuml;he auf
Wir m&ouml;chten uns ganz herzlich bei Dir daf&uuml;r bedanken, dass Du die M&uuml;he auf
dich genommen hast, diesen Bogen auszuf&uuml;llen und somit allen
Studierenden nach dir einiges an Sorgen und Ängsten genommen
hast!<br>