pclib  3.0.0
Lightweight PHP framework
Template tags implemented by class Form

For common attributes see Common form tag attributes.

  • class - Global form parameters
    • form - required for form template
      • name "string" - Form name
      • action "url" - Form tag action attribute.
      • route "route" - Instead of action, you can use route. See PClib route. (*)
      • jsvalid - Enable javascript validation. You must link file pclib/assets/pclib.js when using javascript validation.
      • table "name" - Database table used for configuring form fields and storing form values
      • get - Send form using GET method instead of default POST.
      • noformtag - Do not generate <form> </form> tags
      • html5 - enable html5 validation and html5 form fields
      • format "nhHulsf" Enable preformatting of form values. See string "format" attribute. Ex: Do not allow inserting of dangerous html code: format "h" (It will escapes html tags, when submitted)
      • use "modules" comma separated list of modules loaded into template from $app->globals service
      • entity "name" Optional entity name for storing files
  • input - Create INPUT tag
    • size "size" | size "size/maxlength" - Set size and maxlength attributes of INPUT. Ex: size "20/100"
    • password ["minlength,extrachars"] - Create INPUT TYPE="password" You can set minimal length and require non-alphanumeric characters to be present. Ex: input PASSWORD password
    • file - Create INPUT TYPE="file".
      • into "path" - Directory where file will be stored.
      • size_mb "size" - Max. size of file allowed in MB - e.g. "1.5"
      • accept "file-types" Allowed file types - see html5 attribute "accept". Ex: accept "image/*" (images only)
    • hidden - Create INPUT TYPE="hidden"
    • number - User input will be converted to number (each non-numeric character is removed). 'number "strict"' throw error, if input is not a number.
    • email - Only correct email addresses are allowed
    • date | date "fmt" - Expect date in format "fmt" and convert it to database format before saving. Format can contain d,m,y parameters - it specifies day, month and year date sections.
    • color - Create html5 color selector
    • range - Create html5 range selector
  • text - Create TEXTAREA tag
    • size "COLUMNSxROWS"
    • maxlength "number" Set maxlength attribute of the TEXTAREA
  • button - Create INPUT TYPE=SUBMIT|BUTTON or <BUTTON> tag.
    • href "url" - Open url when button is pressed. (*)
    • route "route" - Instead of href, you can use route. See PClib route.
    • popup ["params"] - Open link in popup window. (For more info see tpl tag "link" Template tags implemented by class Tpl)
    • onclick "javascript" - Create input type=button with onclick attribute.
    • tag - Define if use BUTTON or INPUT tag. Ex: button submit tag "button".
    • confirm "question" - Show javascript confirm dialog with "question"
    • default - use for form with one submit button (skip magic with calling actions based on the name of the button)
  • radio - Create INPUT TYPE=RADIO group
  • check - Create INPUT TYPE=CHECKBOX or group of checkboxes
    • columns "number" - Number of columns used for printing checkbox group.
    • list | query | lookup - Datasource - see Common attributes of template tags
    • You can use "check" even without datasource - single checkbox is created then.
  • select - Create SELECT tag
    • list | query | lookup - Datasource - see Common attributes of template tags
    • emptylb "label" - Label for empty (unselect) option.
    • noemptylb - Disable empty-label of the select element
  • listinput - Create html5 input with pulldown menu

    (*) Note that in both attributes - route and href - you can place any template tag value since 1.5.0. Ex: href "company.php?id={ID}" {GET} or {GET.variablename} is also supported. See PClib route.

    In addition you can use Template tags implemented by class Tpl too.