Top  Branding  Banner 
blank.gif
blank.gif
triangle.gif Du er her: /  Forsiden  /  Kildekoden  /  Form  /  Formtag   Login nu   Login
blank.gif
««« Se kilde koden
blank.gif
tl.gif Base tr.gif tl.gif Basic tr.gif tl.gif Dto tr.gif tls.gif     Form  trs.gif tl.gif Language tr.gif tl.gif Layout tr.gif tl.gif Menu tr.gif tl.gif Mvc tr.gif tl.gif Netbank.eksperter.dk tr.gif tl.gif Tab tr.gif tl.gif Table tr.gif tl.gif Util tr.gif
blank.gif
blank.gif
arrow-headline.gif Index
MenuLink  MenuLeft  
Tilbage

Skjul: Navn

FormTag.php


Vis: Sample code, tutorial

FormTag, Sample code, tutorial

Sådan benyttes komponenten FormTag klassen

Først skal du inkludere den fil der beskriver komponenten, som en klasse fil

  • <?
    require_once(HTML_PACKAGE_PATH.'/FormTag.php');
    ?>

Dernæst kan du enten benytte komponenten som et taglib (statiske metoder):

  • <?
    FormTag
    ::display($param1$param2$param3, ...);
    ?>

eller du kan lave en instance af komponenten og benytte metoderne direkte:

  • <?
    $object 
    = new FormTag($param1$param2$param3, ...);
    print 
    $object->getHtml();
    ?>

Skjul: Sådan vises komponenten

FormTag, Sådan vises komponenten

Sådan vises komponenten FormTag klassen


Vis: PHP source code

FormTag, PHP source code

Den fulde PHP kildekode for FormTag klassen

<?php
/**
 * @package form
 * @filesource
 * @see HTML_FORM_COMPONENT_PATH.'/Form.php'
 * @copyright (c) http://Finn-Rasmussen.com
 * @license http://Finn-Rasmussen.com/license/ myPHP License conditions
 * @author http://Finn-Rasmussen.com
 * @version 1.11
 * @since 27-nov-2009
 */

/**
 * The required files
 */
require_once(HTML_BASE_UTIL_PATH.'/Element.php'); // REQUIRED
require_once(HTML_FORM_COMPONENT_PATH.'/Form.php');
require_once(
HTML_FORM_COMPONENT_PATH.'/Label.php');
require_once(
HTML_FORM_COMPONENT_PATH.'/Input.php');
require_once(
HTML_FORM_COMPONENT_PATH.'/Text.php');
require_once(
HTML_FORM_COMPONENT_PATH.'/Disabled.php');
require_once(
HTML_FORM_COMPONENT_PATH.'/Readonly.php');
require_once(
HTML_FORM_COMPONENT_PATH.'/Hidden.php');
require_once(
HTML_FORM_COMPONENT_PATH.'/Button.php');
require_once(
HTML_FORM_COMPONENT_PATH.'/Password.php');
require_once(
HTML_FORM_COMPONENT_PATH.'/ResetButton.php');
require_once(
HTML_FORM_COMPONENT_PATH.'/CancelButton.php');
require_once(
HTML_FORM_COMPONENT_PATH.'/SubmitButton.php');
require_once(
HTML_FORM_COMPONENT_PATH.'/ImageButton.php');
require_once(
HTML_FORM_COMPONENT_PATH.'/Radio.php');
require_once(
HTML_FORM_COMPONENT_PATH.'/Checkbox.php');
require_once(
HTML_FORM_COMPONENT_PATH.'/Select.php');
require_once(
HTML_FORM_COMPONENT_PATH.'/Option.php');
require_once(
HTML_FORM_COMPONENT_PATH.'/Textarea.php');
require_once(
HTML_FORM_COMPONENT_PATH.'/Zip.php');
require_once(
HTML_FORM_COMPONENT_PATH.'/Fileupload.php');
if (
defined('HTML_BASE_UTIL_PATH')) {
    require_once(
HTML_BASE_UTIL_PATH.'/Fieldset.php');
    require_once(
HTML_BASE_UTIL_PATH.'/Legend.php');
}

/**
 * Generates a html form utilizing the tag library
 * <code>
 * Usage:
 *   $form = new FormTag($action, $method, $name, $attr, $title, $onsubmit, $enctype);
 *   $form->add(new SubmitButton($action, $method, $name, $attr, $title, $onsubmit));
 *   print $form->getHtml();
 * Or:
 *   FormTag::start($action, $method, $name, $attr, $title, $onsubmit, $enctype);
 *   elements::display()
 *   FormTag::end();
 * Or:
 *   FormTag::start($action, $method, $name, $attr, $title, $onsubmit, $enctype);
 *   FormTag::textarea();
 *   FormTag::submitbutton();
 *       :
 *   FormTag::end();
 * </code>
 * @package form
 */
class FormTag extends Form {
    
/**
     * Constructor
     * @param String $action   The action where to go, default 'self'
     * @param String $method   The method get/post
     * @param String $name     The name if any (NOT xhtml 1.0 strict compliant)
     * @param String $attr     Additional attributes, i.e. 'enctype="multipart/form-data"'
     * @param String $title    The title (tooltip)
     * @param String $onsubmit The onsubmit event
     * @param String $enctype  The encoding type
     */
    
function __construct($action=''$method=''$name=''$attr=''$title=''$onsubmit=''$enctype='') {
        
parent::__construct($action$method$name$attr$title$onsubmit$enctype);
    }

    
// ***********    FORM ELEMENTS    ***********

    /**
     * Display html
     * <code>
     * Usage:
     *    Form::selectstart($name, $class, $onchange, $multiple, $size, $disabled, $onclick, $title, $tabindex); 
     * </code> 
     * @static
     * @param String $name      The name of the control
     * @param String $class     The class name
     * @param String $onchange  On Change Event name i.e. 'EMNE'
     * @param String $multiple  The multiple attribute
     * @param String $size      The size attribute
     * @param String $disabled  The disabled
     * @param String $onclick   On Click Event name i.e. 'EMNE'
     * @param String $title     The tooltip
     * @param String $tabindex  The tabindex
     */
    
public static function selectstart($name$class=''$onchange=''$multiple=''$size=''$disabled=''$onclick=''$title=''$tabindex='') {
        
Select::start($name$class$onchange$multiple$size$disabled$onclick$title$tabindex);
    }

    
/**
     * Display html
     * <code>
     * Usage:
     *    Form::option($text, $value, $selected, $title); 
     * </code> 
     * @static
     * @param String $text     The text to show
     * @param String $value    The value, if any
     * @param String $selected The option is selected
     * @param String $title    The tooltip
     */
    
public static function option($text$value=''$selected=''$title='') {
        
Option::display($text$value$selected$title);
    }

    
/**
     * Display html
     * <code>
     * Usage:
     *    Form::selectend(); 
     * </code> 
     * @static
     */
    
public static function selectend() {
        
Select::end();
    }

    
/**
     * Display html
     * <code>
     * Usage:
     *    Form::label($text, $for, $accesskey, $class); 
     * </code> 
     * @static
     * @param String $text  The text to show
     * @param String $for   The ID for the control to relate to
     * @param String $accesskey The accesskey
     * @param String $class The class name
     */
    
public static function label($text$for=''$accesskey=''$class='') {
        
Label::display($text$for$accesskey$class);
    }

    
/**
     * Display html
     * <code>
     * Usage:
     *    Form::legend($text, $class, $accesskey); 
     * </code> 
     * @static
     * @param String $text      The text to show
     * @param String $class     The class name
     * @param String $accesskey The access key
     */
    
public static function legend($text$class=''$accesskey='') {
        
Legend::display($text$class$accesskey);
    }

    
/**
     * Display html
     * <code>
     * Usage:
     *    Form::fieldsetstart($legend, $class); 
     * </code> 
     * @static
     * @param String $legend The legend object to use
     * @param String $class  The css class of the link
     */
    
public static function fieldsetstart($legend=''$class='') {
        
Fieldset::start($legend$class);
    }

    
/**
     * Display html
     * <code>
     * Usage:
     *    Form::fieldsetend(); 
     * </code> 
     * @static
     */
    
public static function fieldsetend() {
        
Fieldset::end();
    }

    
/**
     * Display html
     * <code>
     * Usage:
     *    Form::textarea($name, $text, $rows, $cols, $class, $title, $tabindex, $accesskey, $wrap); 
     * </code> 
     * @static
     * @param String $name      The name of the control
     * @param String $text      The text value, if any
     * @param String $rows      The number of rows
     * @param String $cols      The number of columns
     * @param String $class     The class name
     * @param String $tabindex  The tabindex
     * @param String $accesskey The accesskey
     * @param String $wrap      The wrap (virtual,physical,off)
     */
    
public static function textarea($name$text=''$rows=''$cols=''$class=''$title=''$tabindex=''$accesskey=''$wrap='') {
        
Textarea::display($name$text$rows$cols$class$title$tabindex$accesskey$wrap);
    }

    
/**
     * Display html
     * <code>
     * Usage:
     *    Form::input($type, $name, $value, $class, $size, $maxlength, $disabled, $readonly, $onclick, $title, $tabindex, $accesskey);
     * </code> 
     * @static
     * @param String $type  The type (text, radio, checkbox, file, button, hidden, submit, reset)
     * @param String $name  The name
     * @param String $value The value, if any
     * @param String $class The class
     * @param String $size  The size / or checked for radio/checkbox
     * @param String $maxlength The maxlength
     * @param String $disabled  The disabled
     * @param String $readonly  The readonly
     * @param String $onclick   On click event for javascript
     * @param String $title     The tooltip
     * @param String $tabindex  The tabindex
     * @param String $accesskey The accesskey
     */
    
public static function input($type=''$name=''$value=''$class=''$size=''$maxlength=''$disabled=''$readonly=''$onclick=''$title=''$tabindex=''$accesskey='') {
        
Input::display($type$name$value$class$size$maxlength$disabled$readonly$onclick$title$tabindex$accesskey);
    }

    
/**
     * Display html
     * <code>
     * Usage:
     *    Form::text($name, $value, $class, $size, $maxlength, $disabled, $readonly, $onclick, $title, $tabindex, $accesskey);
     * </code> 
     * @static
     * @param String $name      The name
     * @param String $value     The value, if any
     * @param String $class     The class
     * @param String $size      The size
     * @param String $maxlength The maxlength
     * @param String $disabled  The disabled
     * @param String $readonly  The readonly
     * @param String $onclick   On click event for javascript
     * @param String $title     The title
     * @param String $tabindex  The tabindex
     * @param String $accesskey The accesskey
     */
    
public static function text($name=''$value=''$class=''$size=''$maxlength=''$disabled=''$readonly=''$onclick=''$title=''$tabindex=''$accesskey='') {
        
Text::display($name$value$class$size$maxlength$disabled$readonly$onclick$title$tabindex$accesskey);
    }

    
/**
     * Display html
     * <code>
     * Usage:
     *    Form::disabled($name, $value, $class, $size, $maxlength, $disabled, $readonly, $onclick, $title, $tabindex, $accesskey);
     * </code> 
     * @static
     * @param String $name      The name
     * @param String $value     The value, if any
     * @param String $class     The class
     * @param String $size      The size
     * @param String $maxlength The maxlength
     * @param String $disabled  The disabled
     * @param String $readonly  the readonly
     * @param String $onclick   On click event for javascript
     * @param String $title     The tooltip
     * @param String $tabindex  The tabindex
     * @param String $accesskey The accesskey
     */
    
public static function disabled($name=''$value=''$class=''$size=''$maxlength=''$disabled=''$readonly=''$onclick=''$title=''$tabindex=''$accesskey='') {
        
Disabled::display($name$value$class$size$maxlength$disabled$readonly$onclick$title$tabindex$accesskey);
    }

    
/**
     * Display html
     * <code>
     * Usage:
     *    Form::readonly($name, $value, $class, $size, $maxlength, $disabled, $readonly, $onclick, $title, $tabindex, $accesskey);
     * </code> 
     * @static
     * @param String $name      The name
     * @param String $value     The value, if any
     * @param String $class     The class
     * @param String $size      The size
     * @param String $maxlength The maxlength
     * @param String $disabled  The disabled
     * @param String $readonly  The readonly
     * @param String $onclick   On click event for javascript
     * @param String $title     The tooltip
     * @param String $tabindex  The tabindex
     * @param String $accesskey The accesskey
     */
    
public static function readonly($name=''$value=''$class=''$size=''$maxlength=''$disabled=''$readonly=''$onclick=''$title=''$tabindex=''$accesskey='') {
        
Readonly::display($name$value$class$size$maxlength$disabled$readonly$onclick$title$tabindex$accesskey);
    }

    
/**
     * Display html
     * <code>
     * Usage:
     *    Form::password($name, $value, $class, $size, $maxlength, $disabled, $readonly, $onclick, $title, $tabindex, $accesskey);
     * </code> 
     * @static
     * @param String $name      The name
     * @param String $value     The value, if any
     * @param String $class     The class
     * @param String $size      The size
     * @param String $maxlength The maxlength
     * @param String $disabled  The disabled
     * @param String $readonly  The readonly
     * @param String $onclick   On click event for javascript
     * @param String $title     The tooltip
     * @param String $tabindex  The tabindex
     * @param String $accesskey The accesskey
     */
    
public static function password($name=''$value=''$class=''$size=''$maxlength=''$disabled=''$readonly=''$onclick=''$title=''$tabindex=''$accesskey='') {
        
Password::display($name$value$class$size$maxlength$disabled$readonly$onclick$title$tabindex$accesskey);
    }

    
/**
     * Display html
     * <code>
     * Usage:
     *    Form::hidden($name, $value); 
     * </code> 
     * @static
     * @param String $name  the name
     * @param String $value the value, if any
     */
    
function hidden($name=''$value='') {
        
Hidden::display($name$value);
    }

    
/**
     * Display html
     * <code>
     * Usage:
     *    Form::button($name, $value, $class, $disabled, $onclick, $title, $tabindex, $accesskey); 
     * </code> 
     * @static
     * @param String $name      The name
     * @param String $value     The value, if any     
     * @param String $class     The class
     * @param String $disabled  The disabled
     * @param String $onclick   On click event for javascript
     * @param String $title     The tooltip
     * @param String $tabindex  The tabindex
     * @param String $accesskey The accesskey
     */
    
public static function button($name=''$value=''$class=''$disabled=''$onclick=''$title=''$tabindex=''$accesskey='') {
        
Button::display($name$value$class$disabled$onclick$title$tabindex$accesskey);
    }

    
/**
     * Display html
     * <code>
     * Usage:
     *    Form::imagebutton($name, $value, $class, $disabled, $onclick, $title, $tabindex, $accesskey); 
     * </code> 
     * @static
     * @param String $name      The name
     * @param String $value     The value, if any     
     * @param String $class     The class
     * @param String $disabled  The disabled
     * @param String $onclick   On click event for javascript
     * @param String $title     The tooltip
     * @param String $tabindex  The tabindex
     * @param String $accesskey The accesskey
     */
    
public static function imagebutton($name=''$value=''$class=''$disabled=''$onclick=''$title=''$tabindex=''$accesskey='') {
        
ImageButton::display($name$value$class$disabled$onclick$title$tabindex$accesskey);
    }

    
/**
     * Display html
     * <code>
     * Usage:
     *    Form::resetbutton($name, $value, $class, $disabled, $onclick, $title, $tabindex, $accesskey); 
     * </code> 
     * @static
     * @param String $name      The name
     * @param String $value     The value, if any     
     * @param String $class     The class
     * @param String $disabled  The disabled
     * @param String $onclick   On click event for javascript
     * @param String $title     The tooltip
     * @param String $tabindex  The tabindex
     * @param String $accesskey The accesskey
     */
    
public static function resetbutton($name=''$value=''$class=''$disabled=''$onclick=''$title=''$tabindex=''$accesskey='') {
        
ResetButton::display($name$value$class$disabled$onclick$title$tabindex$accesskey);
    }

    
/**
     * Display html
     * <code>
     * Usage:
     *    Form::submitbutton($name, $value, $class, $disabled, $onclick, $title, $tabindex, $accesskey); 
     * </code> 
     * @static
     * @param String $name      The name
     * @param String $value     The value, if any     
     * @param String $class     The class
     * @param String $disabled  The disabled
     * @param String $onclick   On click event for javascript
     * @param String $title     The tooltip
     * @param String $tabindex  The tabindex
     * @param String $accesskey The accesskey
     */
    
public static function submitbutton($name=''$value=''$class=''$disabled=''$onclick=''$title=''$tabindex=''$accesskey='') {
        
SubmitButton::display($name$value$class$disabled$onclick$title$tabindex$accesskey);
    }

    
/**
     * Display html
     * <code>
     * Usage:
     *    Form::fileupload($name, $class, $size, $maxlength, $disabled, $readonly, $onclick, $title, $tabindex, $accesskey, $accept); 
     * </code> 
     * @static
    * @param String $name      The name
    * @param String $class     The class
    * @param String $size      The size / or checked for radio/checkbox
    * @param String $maxlength The maxlength
    * @param String $disabled  The disabled
    * @param String $readonly  The readonly
    * @param String $onclick   On click event for javascript
    * @param String $title     The tooltip
    * @param String $tabindex  The tabindex
    * @param String $accesskey The accesskey
    * @param String $accept    The accept
     */
    
public static function fileupload($name$class=''$size=''$maxlength=''$disabled=''$readonly=''$onclick=''$title=''$tabindex=''$accesskey=''$accept='') {
        
Fileupload::display($name$class$size$maxlength$disabled$readonly$onclick$title$tabindex$accesskey$accept);
    }

    
/**
     * Display html
     * <code>
     * Usage:
     *    Form::cancelbuttonbutton($name, $value, $class, $disabled, $onclick, $title, $tabindex, $accesskey); 
     * </code> 
     * @static
     * @param String $name      The name
     * @param String $value     The value, if any     
     * @param String $class     The class
     * @param String $disabled  The disabled
     * @param String $onclick   On click event for javascript
     * @param String $title     The tooltip
     * @param String $tabindex  The tabindex
     * @param String $accesskey The accesskey
     */
    
public static function cancelbutton($name=''$value=''$class=''$disabled=''$onclick=''$title=''$tabindex=''$accesskey='') {
        
CancelButton::display($name$value$class$disabled$onclick$title$tabindex$accesskey);
    }

    
/**
     * Display html
     * <code>
     * Usage:
     *    Form::radio($name, $value, $class, $checked, $disabled, $onclick, $title, $tabindex, $accesskey); 
     * </code> 
     * @static
     * @param String $name      The name
     * @param String $value     The value, if any
     * @param String $class     The class
     * @param String $checked   The checked, if present
     * @param String $disabled  The disabled
     * @param String $onclick   On click event for javascript
     * @param String $title     The tooltip
     * @param String $tabindex  The tabindex
     * @param String $accesskey The accesskey
     */
    
public static function radio($name=''$value=''$class=''$checked=''$disabled=''$onclick=''$title=''$tabindex=''$accesskey='') {
        
Radio::display($name$value$class$checked$disabled$onclick$title$tabindex$accesskey);
    }

    
/**
     * Display html
     * <code>
     * Usage:
     *    Form::checkbox($name, $value, $class, $checked, $disabled, $onclick, $title, $tabindex, $accesskey); 
     * </code> 
     * @static
     * @param String $name      The name
     * @param String $value     The value, if any     
     * @param String $class     The class
     * @param String $checked   The 'checked', if selected
     * @param String $disabled  The disabled
     * @param String $onclick   On click event for javascript
     * @param String $title     The tooltip
     * @param String $tabindex  The tabindex
     * @param String $accesskey The accesskey
     */
    
public static function checkbox($name=''$value=''$class=''$checked=''$disabled=''$onclick=''$title=''$tabindex=''$accesskey='') {
        
Checkbox::display($name$value$class$checked$disabled$onclick$title$tabindex$accesskey);
    }
}
?>

Vis: HTML source code

FormTag, HTML source code

Den fulde HTML kildekode for FormTag klassen

<?
<!-- DEBUGFormTag -->
<
form action="/source-code/form/FormTag/index.php" method="get" name="FormTag1" id="FormTag1">
</
form>

?>

Vis: Class methods

FormTag, Class methods

Her er 'klasse metoderne' for FormTag klassen:

  • __construct
  • selectstart
  • option
  • selectend
  • label
  • legend
  • fieldsetstart
  • fieldsetend
  • textarea
  • input
  • text
  • disabled
  • readonly
  • password
  • hidden
  • button
  • imagebutton
  • resetbutton
  • submitbutton
  • fileupload
  • cancelbutton
  • radio
  • checkbox
  • getAction
  • getStart
  • getEnd
  • getHtml
  • start
  • end
  • display
  • setObject
  • set
  • get
  • getAttribute
  • getTag
  • add
  • getSizeof
  • getElement
  • getElements
  • getToogle
  • getMaximize
  • getMinimize
  • newTriangle
  • getStartHtml
  • getEndHtml
  • showsource
  • getClassName
  • getMsg
  • addHtml
  • __toString
  • getCacheFileName
  • save
  • content

Vis: Object vars

FormTag, Object vars

Her er 'objekt variable' for FormTag klassen:

  • html =>
  • sql =>

MenuRight 
triangle.gif

Dansk

Deutch

English (UK)

France

Italy

Norsk

Svensk

English (USA)


 
blank.gif
MenuBottom 
triangle.gif Copyright @ 1999-2010 www.Finn-Rasmussen.com Powered by myPHP Version (5.3.3-7+squeeze3) 1.11
blank.gif