WebSite-PHP Framework PHP
Multi language
Simple Ajax mode
No HTML, no JavaScript
URL rewriting
Mail sending
Sitemap - RSS - Web service
Download WebSite-PHP FrameWork now
 


Loading
 


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

Tutorials

>

Tutorial Selectlist

>

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


Selectlist-06: Tutorial of the composant Selectlist of the PHP FrameWork WebSite-PHP.

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




Go back to tutorial of the componant Selectlist



Source code

Source code


File: /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");
    }
}
?>


Go back to tutorial of the componant Selectlist


Share

 


Copyright © 2009-2024 WebSite-PHP Framework PHP
Home Documentation Download Quick start Tutorials Wiki Issue Tracker