Members: 16,996
Threads: 38,845
Posts: 159,389
Online: 20

Newest Member: Kl_broka@rediffmail.com


Odoo.tv - Outdoor Television


Sedo - Domains kaufen und verkaufen das Projekt mambers.com steht zum Verkauf Besucherstatistiken von mambers.com etracker® Web-Controlling statt Logfile-Analyse
Old 27.04.2005, 22:50   #1 (permalink)
Junior Mamber
 
Join Date: Nov 2004
Posts: 46
steve76 is on a distinguished road
Default multiple selectList speichern

hallo @all,

hab folgendes wo ich nicht weiterkomme:

hier hole ich mir für eine multiple selectlist Daten und erzeuge diese:
PHP Code:
$query 'SELECT id AS value, tarifbez_tarifart AS text FROM #__tanzkurse_import ORDER BY kurzbez';
    
$database->setQuery$query );
    
$kurseclubs $database->loadObjectList();
    
$lists['kurseclubs'] = mosHTML::selectList$kurseclubs'kurseclubs[]''class="inputbox" size="15" multiple="multiple"''value''text', array( $row->kurseclubs ) ); 
so sieht das formular dann aus:
Code:
<select name="kurseclubs[]" class="inputbox" size="15" multiple="multiple">
	<option value="461">eintrag1</option>
	<option value="462">eintrag2</option>
	<option value="473">eintrag3</option>
	<option value="477">eintrag4</option>
</select>

mit dieser funktion speichere ich meine daten:
PHP Code:
/**
* Saves the record on an edit form submit
* @param database A database connector object
*/
function saveTanzKurse$option ) {
    global 
$database$my;
    

    
$row = new mostanzkurse$database );
    
    if (!
$row->bind$_POST )) {
        echo 
"<script> alert('".$row->getError()."'); window.history.go(-1); </script>\n";
        exit();
    }
    
$row->date date"Y-m-d H:i:s" );
    
    if (!
$row->store()) {
        echo 
"<script> alert('".$row->getError()."'); window.history.go(-1); </script>\n";
        exit();
    }
    
    
$row->checkin();
    
$row->updateOrder"catid='$row->catid'" );

    
mosRedirect"index2.php?option=$option" );

das speichern funktioniert mein problem ist das die Auswahl von der selectList nicht korrekt in die Datenbank gespeichert wird, sondern dort steht dann nur
Array.

Hat jemand ne Idee was ich falsch mache?

gruss steve
steve76 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
Old 27.04.2005, 23:26   #2 (permalink)
Professional Mamber
 
zorkhh's Avatar
 
Join Date: Apr 2004
Location: Northern Germany
Posts: 713
zorkhh is on a distinguished road
Default Re: multiple selectList speichern

Hallo,

"ARRAY" ist bereits der beste Tip, den Du bekommen konntest: die Rückgabe der Werte findet nämlich in einem Array statt, deren Werte Du jeweils einzeln speichern mußt...

Gruß, ZorkHH
__________________
News and stories around Joomla! PlanetJoomla.com
For individual Joomla-AddOns visit Joomlaexpert.com
zorkhh is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 27.04.2005, 23:58   #3 (permalink)
Junior Mamber
 
Join Date: Nov 2004
Posts: 46
steve76 is on a distinguished road
Default Re: multiple selectList speichern

hallo,

danke für den Tipp. Hätt ich ja eigentlich selbst drauf kommen können

hab beim speichern jetzt folgendes hinzugefügt:
PHP Code:
    $kursdaten mosGetParam$_POST'kurseclubs', array() );
    
    
$cids implode','$kursdaten );
    
    
$database->setQuery"UPDATE #__tanzkurse"
    
"\nSET kurseclubs='$cids'"
    
"\nWHERE catid='$row->catid'"
    
);
    
$database->query(); 
Klappt jetzt super
steve76 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 01.06.2005, 20:26   #4 (permalink)
Baby Mamber
 
Join Date: May 2005
Posts: 2
stell is on a distinguished road
Default Re: multiple selectList speichern

Hallo,
ich habe das gleiche Problem, bekomme es aber nicht hin.
Welchen Typ in der DB hat denn das Feld kurseclubs bei dir?
Ich habe da ein varchar(50) genommen in dem, nach dem Implode, die IDs mit Kommata getrennt stehen.
Die Selektion und das Abspeichern funktionieren, nur am Auslesen und Darstellen haperts.

So verkürzt siehts bei mir aus:


PHP Code:
function save($option) {
global 
$database;
$row = new synman($database);
$_POST['gebiet'] = implode',' $_POST['gebiet']);
$row -> bind($_POST)
$row -> store()
}


function 
edit($option$uid$activetab='0' ) {
global 
$database;
$row = new synman($database);
$database->setQuery"SELECT gebiet_id AS value, gebiet AS text FROM #__synman_gebiet ORDER BY gebiet" );    
$gebiete $database->loadObjectList();
$lists["gebiete"] = mosHTML::selectList$gebiete'gebiet[]''class="inputbox" size="5" multiple''value''text', array($row->gebiet));
 
HTML_synman::edit($option$row$lists$activetab);

stell is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 02.06.2005, 01:36   #5 (permalink)
Baby Mamber
 
Join Date: May 2005
Posts: 2
stell is on a distinguished road
Default Re: multiple selectList speichern

Dacht ich mir, dass sich zu dieser späten Stunde keiner mehr rumtreibt..
Folgendermaßen hab ichs gelöst:

PHP Code:
$gebiete explode(","$row->gebiet);
foreach (
$gebiete as $val) {
    
$gebiet_obj[$val]->value $val;
}    
    
$lists["gebiet"] = mosHTML::selectList$gebiet'gebiet[]''class="inputbox" size="5" multiple="multiple"''value''text'$gebiet_obj); 
stell is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Best methods for managing multiple Mambo installs. coling Mambo 4.5 'How Do I' Questions 7 14.12.2005 10:20
Problems with multiple template features demito Template Discussions 6 01.12.2005 14:55
multiple sites, multiple admins, one code base till Mambo 4.5.1 'How Do I' Questions 3 25.08.2005 03:17
Multiple items selection BrickTop Mamboport.de 1 01.02.2005 18:50
User System for multiple sites (like Microsoft Passport) ccdog Mambo 5.0 Wishlist 0 09.07.2004 18:06


All times are GMT +2. The time now is 04:00.

Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.1.0
A vBSkinworks Design
© Copyright 2004-2008 by Arthur Konze Webdesign.