Multi language
Simple Ajax mode
No HTML, no JavaScript
URL rewriting
Mail sending
Sitemap - RSS - Web service
 


Loading
 


Framework PHP

Framework PHP


Home Home


Documentation Documentation

Download Download


Contact Contact


 
HelpHelp

Quick start Quick start


Help videos Help videos


Tutorials Tutorials


Wiki Wiki
Issue Tracker Issue Tracker
Eclipse PHP Eclipse PHP


 
LanguagesLanguages




 
SupportSupport

 
CompatibilitiesCompatibilities




 
ComponentsComponents

jQuery
CkEditor

 
Tutorial TextboxTutorials > Tutorial Textbox


Tutorial 1 : Simple TextBox
<?php
class Textbox01 extends Page {
    public function 
InitializeComponent() {
        
parent::$PAGE_TITLE "Tutorial : Simple TextBox";
        
        
$this->render = new TextBox($this);
    }
}
?>


Tutorial 2 : Simple TextBox with default text
<?php
class Textbox02 extends Page {
    public function 
InitializeComponent() {
        
parent::$PAGE_TITLE "Tutorial : Simple TextBox 
                                with default text"
;
        
        
$this->render = new TextBox($this);
        
$this->render->setValue("default text");
    }
}
?>


Tutorial 3 : TextBox with presence live validation
<?php
class Textbox03 extends Page {
    public function 
InitializeComponent() {
        
parent::$PAGE_TITLE "Tutorial : TextBox with presence 
                                live validation"
;
        
        
$form = new Form($this); 
        
        
$edt_text = new TextBox($form);
        
$text_box_validation = new LiveValidation();
        
$text_box_validation->addValidatePresence();
        
$edt_text->setLiveValidation($text_box_validation);
        
        
$form->setContent($edt_text);
        
$this->render $form;
    }
}
?>


Tutorial 4 : TextBox with multi live validation (numeric, mail, presence)
<?php
class Textbox04 extends Page {
    public function 
InitializeComponent() {
        
parent::$PAGE_TITLE "Tutorial : TextBox with multi live 
                            validation (numeric, mail, presence)"
;
        
        
$form = new Form($this); 
        
$table = new Table();
        
        
$edt_numeric = new TextBox($form);
        
$edt_numeric_validation = new LiveValidation();
        
$edt_numeric_validation->addValidatePresence();
        
$edt_numeric_validation->addValidateNumericality();
        
$edt_numeric->setLiveValidation($edt_numeric_validation);
        
        
$table->addRowColumns(new Label("Number :&nbsp;"true)
                                , 
$edt_numeric);
        
        
$edt_mail = new TextBox($form);
        
$edt_mail_validation = new LiveValidation();
        
$edt_mail_validation->addValidatePresence();
        
$edt_mail_validation->addValidateEmail();
        
$edt_mail->setLiveValidation($edt_mail_validation);
        
        
$table->addRowColumns(new Label("Email :&nbsp;"true)
                                , 
$edt_mail);
        
        
$form->setContent($table);
        
$this->render $form;
    }
}
?>


Tutorial 5 : TextBox with onchange javascript event
<?php
class Textbox05 extends Page {
    public function 
InitializeComponent() {
        
parent::$PAGE_TITLE "Tutorial : TextBox with onchange
                                 javascript event"
;
        
        
$this->render = new TextBox($this);
        
$this->render->onChangeJs("alert('change');");
    }
}
?>


Tutorial 6 : TextBox with form, callback method on change
<?php
class Textbox06 extends Page {
    public function 
InitializeComponent() {
        
parent::$PAGE_TITLE "Tutorial : TextBox with form, 
                                callback method on change"
;
        
        
$form = new Form($this);
        
        
$edt_text = new TextBox($form);
        
$edt_text->onChange("onChangeTextBox");
        
        
$form->setContent($edt_text);
        
$this->render $form;
    }
    
    public function 
onChangeTextBox($sender) {
        
$this->addObject(new JavaScript("alert('change');"));
    }
}
?>


Tutorial 7 : TextBox with form, callback method on change in AJAX
<?php
class Textbox07 extends Page {
    private 
$edt_text null;
    
    public function 
InitializeComponent() {
        
parent::$PAGE_TITLE "Tutorial : TextBox with form, 
                        callback method on change in AJAX"
;
        
        
$form = new Form($this);
        
        
$this->edt_text = new TextBox($form);
        
$this->edt_text->onChange("onChangeTextBox");
        
$this->edt_text->setAjaxEvent();
        
        
$form->setContent($this->edt_text);
        
$this->render $form;
    }
    
    public function 
onChangeTextBox($sender) {
        
$dialog = new DialogBox("onChangeTextBox"
                    
strip_tags($this->edt_text->getValue()));
        
$this->addObject($dialog);
    }
}
?>



Share




Copyright © 2009-2012 WebSite-PHP Framework PHP
Home Documentation Download Quick start Tutorials Wiki Issue Tracker
Site created with framework WebSite-PHP