WebSite-PHP Framework PHP
Mehrsprachig
Einfacher Ajax Modus
Kein HTML, kein JavaScript
URL Rewriting
Mails senden
Sitemap - RSS - Web service
Laden Sie WebSite-PHP FrameWork jetzt herunter
 


Loading
 


Tutorial : TextBox search 
with autocomplete and dynamic filter

Tutorials

>

Tutorial Textbox

>

Tutorial : TextBox search with autocomplete and dynamic filter


Textbox-09: Tutorial der Komponente Textbox vom PHP FrameWork WebSite-PHP.

Tutorial : TextBox search with autocomplete and dynamic filter:



Zurück zum Tutorial der Komponente Textbox



Quelltext

Quelltext


Datei: /pages/tutorials/textbox/textbox-09.php

<?php
class Textbox09 extends Page {
    public function 
InitializeComponent() {
        
parent::$PAGE_TITLE "Tutorial : TextBox search 
                    with autocomplete and dynamic filter"
;
        
        
$form = new Form($this);
        
        
// Create ComboBox object (filter)
        // List of actif and inactif is available on:
        // http://www.website-php.com/en/tutorials/database/database-05.html
        // You can modify the list of inactif on:
        // http://www.website-php.com/en/tutorials/database/database-07.html
        
$filter = new ComboBox($form);
        
$filter->addItem(1"ACTIF");
        
$filter->addItem(0"INACTIF");
        
        
// Create TextBox object
        
$search_text = new TextBox($form);
        
        
// Create AutoCompleteEvent object
        
$autocompete_event = new AutoCompleteEvent($form);
        
$autocompete_event->onSelect("onSelectAutoComplete");
        
$autocompete_event->setAjaxEvent();
        
$autocompete_event->disableAjaxWaitMessage();
        
        
// Create AutoComplete object (with filter in the URL)
        
$autocomplete = new AutoComplete(
            new 
Url("xml/textbox-search.json?".
            
"filter='+$('#".$filter->getId()."').val()+'"), 
            
1$autocompete_event);

        
// Refresh URL when change filter
        
$filter->onChangeJS("$('#".$search_text->getId()."').autocomplete(".
            
"'option', 'source', '".$this->getBaseLanguageURL().
            
"xml/textbox-search.json?".
            
"filter='+$('#".$filter->getId()."').val());");
            
        
// Set autocomplete on the TextBox
        
$search_text->setAutoComplete($autocomplete);
        
$form->setContent(new WSPObject($filter$search_text));
        
        
$this->render $form;
    }
    
    public function 
onSelectAutoComplete($sender$id) {
        
$this->addObject(
            new 
DialogBox("onSelectAutoComplete"
                                
"URL: ".$id)
            );
    }
}
?>


Zurück zum Tutorial der Komponente Textbox



Share

 


Copyright © 2009-2024 WebSite-PHP Framework PHP
Start Dokumentation Herunterladen Schnellstart Tutorials Wiki Issue Tracker