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
 


Tutorial : Select an element on
a SelectList load values in a second SelectList

Tutoriels

>

Tutoriel Selectlist

>

Tutorial : Select an element on a SelectList load values in a second SelectList


Selectlist-06: Tutoriel du composants Selectlist du FrameWork PHP WebSite-PHP.

Tutorial : Select an element on a SelectList load values in a second SelectList:




Retourner aux tutoriels du composants Selectlist



Code source

Code source


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 Object($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");
    }
}
?>


Retourner aux tutoriels du composants Selectlist


Share

 


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