WebSite-PHP Framework PHP
Multi langues
Mode Ajax simple
Aucun HTML, aucun JavaScript
URL rewrinting
Envoi d'email
Sitemap - RSS - Web service
Télécharger le Framework WebSite-PHP maintenant
 


Loading
 


Tutoriel Selectlist

Tutoriels

>

Tutoriel Selectlist



Tutoriel 1 : Simple SelectList
Fichier: /pages/tutorials/selectlist/selectlist-01.php

<?php
class Selectlist01 extends Page {
    public function 
InitializeComponent() {
        
parent::$PAGE_TITLE "Tutorial : Simple SelectList";
        
        
$this->render = new SelectList($this);
        
$this->render->addItem("value 1""value 1");
        
$this->render->addItem("value 2""value 2");
        
$this->render->addItem("value 3""value 3");
        
$this->render = new WSPObject($this->render"<br/>");
    }
}
?>


Tutoriel 2 : Multiline SelectList
Fichier: /pages/tutorials/selectlist/selectlist-02.php

<?php
class Selectlist02 extends Page {
    public function 
InitializeComponent() {
        
parent::$PAGE_TITLE "Tutorial : Multiline SelectList";
        
        
$this->render = new SelectList($this);
        
$this->render->setNbLines(6);
        
$this->render->addItem("value 1""value 1");
        
$this->render->addItem("value 2""value 2");
        
$this->render->addItem("value 3""value 3");
        
$this->render->addItem("value 4""value 4");
        
$this->render->addItem("value 5""value 5");
        
$this->render->addItem("value 6""value 6");
        
$this->render = new WSPObject($this->render"<br/>");
    }
}
?>


Tutoriel 3 : select an index on a SelectList on load
Fichier: /pages/tutorials/selectlist/selectlist-03.php

<?php
class Selectlist03 extends Page {
    public function 
InitializeComponent() {
        
parent::$PAGE_TITLE "Tutorial : select an index on 
                    a SelectList on load"
;
        
        
$this->render = new SelectList($this);
        
$this->render->setNbLines(3);
        
$this->render->addItem("value 1""value 1");
        
$this->render->addItem("value 2""value 2");
        
$this->render->addItem("value 3""value 3");
        
$this->render->addItem("value 4""value 4");
        
$this->render->setSelectedIndex(2);
        
$this->render = new WSPObject($this->render"<br/>");
    }
}
?>


Tutoriel 4 : SelectList with javascript alert on change
Fichier: /pages/tutorials/selectlist/selectlist-04.php

<?php
class Selectlist04 extends Page {
    public function 
InitializeComponent() {
        
parent::$PAGE_TITLE "Tutorial : SelectList with javascript 
                                alert on change"
;
        
        
$this->render = new SelectList($this);
        
$this->render->setNbLines(3);
        
$this->render->addItem("value 1""value 1");
        
$this->render->addItem("value 2""value 2");
        
$this->render->addItem("value 3""value 3");
        
$this->render->addItem("value 4""value 4");
        
$this->render->onChangeJs("alert('change');");
        
$this->render = new WSPObject($this->render"<br/>");
    }
}
?>


Tutoriel 5 : SelectList with form, callback method on change in AJAX
Fichier: /pages/tutorials/selectlist/selectlist-05.php

<?php
class Selectlist05 extends Page {
    public function 
InitializeComponent() {
        
parent::$PAGE_TITLE "Tutorial : SelectList with form, 
                            callback method on change in AJAX"
;
        
        
$form = new Form($this);
        
        
$this->selectlist = new SelectList($form);
        
$this->selectlist->setNbLines(3);
        
$this->selectlist->addItem("value 1""value 1");
        
$this->selectlist->addItem("value 2""value 2");
        
$this->selectlist->addItem("value 3""value 3");
        
$this->selectlist->addItem("value 4""value 4");
        
$this->selectlist->addItem("value 5""value 5");
        
$this->selectlist->addItem("value 6""value 6");
        
$this->selectlist->onChange("onChangeSelectList");
        
$this->selectlist->setAjaxEvent();
        
$this->selectlist->setStripTags();
        
        
$form->setContent($this->selectlist);
        
$this->render $form;
        
$this->render = new WSPObject($this->render"<br/>");
    }
    
    public function 
onChangeSelectList($sender) {
        
$dialog = new DialogBox("onChangeSelectList"
                        
$this->selectlist->getValue());
        
$this->addObject($dialog);
    }
}
?>


Tutoriel 6 : Select an element ona SelectList load values in a second SelectList
Fichier: /pages/tutorials/selectlist/selectlist-06.php

<?php
class Selectlist06 extends Page {
    public function 
InitializeComponent() {
        
parent::$PAGE_TITLE "Tutorial : Select an element on
                    a SelectList load values in a second SelectList"
;
        
        
$form = new Form($this);
        
        
$this->selectlist1 = new SelectList($form);
        
$this->selectlist1->setNbLines(3);
        
$this->selectlist1->addItem("value 1""value 1");
        
$this->selectlist1->addItem("value 2""value 2");
        
$this->selectlist1->addItem("value 3""value 3");
        
$this->selectlist1->addItem("value 4""value 4");
        
$this->selectlist1->addItem("value 5""value 5");
        
$this->selectlist1->addItem("value 6""value 6");
        
$this->selectlist1->onChange("onChangeSelectList");
        
$this->selectlist1->setAjaxEvent();
        
$this->selectlist1->setStripTags();
        
        
$this->selectlist2 = new SelectList($form);
        
$this->selectlist2->setNbLines(3);
        
$this->selectlist2->setStripTags();
        
        
$form->setContent(new WSPObject($this->selectlist1
                                    
$this->selectlist2,
                                    
"<br/>"));
        
$this->render $form;
    }
    
    public function 
onChangeSelectList($sender) {
        
$this->selectlist2->removeItems();
        
$sel_value $this->selectlist1->getValue();
        
$this->selectlist2->addItem($sel_value."1"$sel_value."1");
        
$this->selectlist2->addItem($sel_value."2"$sel_value."2");
        
$this->selectlist2->addItem($sel_value."3"$sel_value."3");
    }
}
?>


Tutoriel 7 : SelectListMultiple with form, callback method on change in AJAX
Fichier: /pages/tutorials/selectlist/selectlist-07.php

 <?php
class Selectlist07 extends Page {
    public function 
InitializeComponent() {
        
parent::$PAGE_TITLE "Tutorial : SelectListMultiple with form, 
                            callback method on change in AJAX"
;
        
        
$form = new Form($this);
        
        
$this->selectlist = new SelectListMultiple($form);
        
$this->selectlist->setNbLines(6);
        
$this->selectlist->addItem("value1""value 1");
        
$this->selectlist->addItem("value2""value 2");
        
$this->selectlist->addItem("value3""value 3");
        
$this->selectlist->addItem("value4""value 4");
        
$this->selectlist->addItem("value5""value 5");
        
$this->selectlist->addItem("value6""value 6");
        
$this->selectlist->onChange("onChangeSelectList");
        
$this->selectlist->setAjaxEvent();
        
$this->selectlist->setStripTags();
        
        
$form->setContent($this->selectlist);
        
$this->render $form;
        
$this->render = new WSPObject($this->render"<br/>");
    }
    
    public function 
onChangeSelectList($sender) {
        
$dialog = new DialogBox("onChangeSelectList"
                        
implode(", "$this->selectlist->getValue()));
        
$this->addObject($dialog);
    }
}
?> 



Share

 


Copyright © 2009-2024 WebSite-PHP Framework PHP
Accueil Documentation Télécharger Quick start Tutoriels Wiki Issue Tracker