logo-radria.gif
   
Blog Download Documentation Forum Tasks Home
Blog Download Documentation Forum Tasks Home
barside-right.gif
barside-left.gif
logo-sql.gif





Default Field types

Below is a list of the available default Radria field types. In context form, all of the registry fields generate HTML Form fields and are set with the default “class=adformfield” Included is a detailed list of all field types and how they are used.

One Line text

  • Radria fieldtype: FieldTypeChar
  • Extend RegistryFieldStyle → RegistryFieldBase
  • SQL Type: varchar
  • Variables (rdata): fieldtype, default, hidden, readonly, label, size, maxlenght, textline, ordering, dispalign, disabled, execute, substring
  • In Form Context: Generates an HTML input text field that takes varchar input.
  • In Disp Context: Display the content of a varchar field.
  • Usage of rdata textline: <rdata type=“textline”>{display size in characters}:{maximum number of characters for input}</rdata>

Example in PHP:

  $fields = new Fields();
  $fields->addField("firstname", "FieldTypeChar");
  $fields->firstname->required = 1;
  $fields->firstname->label = "First Name";
  $fields->firstname->size = 10;
  $fields->firstname->maxlenght = 30;
  $fields->firstname->css_form_style = "font-size:30px;font-weight:bold;";

Example in XML (serialized)

  <rfield name="firstname">
    <rdata type="required">1</rdata>
    <rdata type="default">Your Name</rdata>
    <rdata type="label">First Name</rdata>
    <rdata type="textline">10:30</rdata>
    <rdata type="fieldtype">FieldTypeChar</rdata>
    <rdata type="databasetype">varchar</rdata>
  </rfield>

Check Box

  • Radria fieldtype: strFBFieldTypeCheckBox
  • SQL Type: varchar
  • rdata (options): checked_value, fieldtype, default, hidden, readonly, label, checkbox, ordering, dispalign
  • In Form Context: Generates HTML for an input field type checkbox and sets the value to the content of the rdata checked_value. If the value of the field equals the value in the checked_value rdata then the checkbox is displayed as checked.
  • In Context Disp: Displays the content of the varchar field.

Exemple:

  <rfield name="accepteterms">
    <rdata type="checked_value">Yes</rdata>
    <rdata type="unchecked_value">No</rdata>
    <rdata type="default">Yes</rdata>
    <rdata type="label">Do you accept the terms</rdata>
    <rdata type="fieldtype">FieldTypeCheckBox</rdata>
    <rdata type="checkbox">1</rdata>
    <rdata type="databasetype">varchar</rdata>
  </rfield>

Email

  • Radria fieldtype: FieldTypeEmail
  • SQL Type: varchar
  • rdata (options): fieldtype, default, hidden, readonly, label, email, textline, ordering, dispalign, disabled, execute
  • In Form Context: Generates an HTML input text field and adds the event-action mydb.checkEmail that verifies if the domain name for that email address exists.
  • In Context Disp: Displays an email address in an HTML link with mailto.

Example:

  <rfield name="email_field">
    <rdata type="email">1</rdata>
    <rdata type="label">Email field</rdata>
    <rdata type="textline">20:40</rdata>
    <rdata type="fieldtype">FieldTypeEmail</rdata>
    <rdata type="databasetype">varchar</rdata>
  </rfield>

File

  • Radria fieldtype: strFBFieldTypeFile
  • SQLType: varchar
  • rdata (options): fieldtype, default, hidden, readonly, label, picture, showpicture, ordering, dispalign, execute, overwrite
  • In Form Context: Generates an HTML File field and adds the event-action mydb.formatPictureField to manage the uploaded file. The name of the file uploaded will be stored in the database field. By default when 2 files with the same name are uploaded the second one will overwrite the first. To avoid that you can set the rdata: overwrite to no.
  • In Disp Context: If you have set the rdata showpicture to 1 it will generate the HTML to display the image. (<img src=”{directory name}/{varchar field content}”>), otherwise it will display the content of the varchar field.
  • Usage of rdata picture: <rdata type=”picture”>{directory name}</rdata>
  • Usage of rdata showpicture: <rdata type=“showpicture”>{boolean 0 or 1}</rdata>

Example:

  <rfield name="productpricture">
    <rdata type="label">Picture of the product</rdata>
    <rdata type="picture">dbimage</rdata>
    <rdata type="showpicture">1</rdata>
    <rdata type="overwrite">no</rdata>
    <rdata type="fieldtype">FieldTypeFile</rdata>
    <rdata type="databasetype">varchar</rdata>
  </rfield>

This example will upload files to the dbimage directory.

Float Number

  • Radria fieldtype: strFBFieldTypeFloat
  • SQL Type: Float
  • rdata (options): fieldtype, default, hidden, readonly, label, textline, ordering, dispalign, numberformat, disabled
  • In Form Context: This field type extends the strFBFieldTypeChar (one line of text). It behaves identically.
  • In Disp Context: Displays the content of the float field.

Example:

  <rfield name="distance">
    <rdata type="label">distance in miles</rdata>
    <rdata type="textline">5:10</rdata>
    <rdata type="fieldtype">FieldTypeFloat</rdata>
    <rdata type="numberformat">$:1:.:,:</rdata>
    <rdata type="databasetype">float</rdata>
  </rfield>

Integer Number

  • Radria fieldtype: strFBFieldTypeInt
  • SQL Type: integer
  • rdata (options): fieldtype, default, hidden, readonly, label, textline, ordering, dispalign, numberformat, disabled
  • In Form Context: This field type extends the strFBFieldTypeChar (one line of text). It behaves identically.
  • In Disp Context: Displays the content of the Int field.

Example:

  <rfield name="age">
    <rdata type="default">28</rdata>
    <rdata type="label">integer</rdata>
    <rdata type="textline">2:2</rdata>
    <rdata type="fieldtype">FieldTypeInt</rdata>
    <rdata type="databasetype">integer</rdata>
  </rfield>

List Box

  • Radria fieldtype: FieldTypeListBox
  • SQL Type: varchar
  • Variables (RData): fieldtype, default, hidden, readonly, label, list, emptydefault, ordering, dispalign, table_name, table_field_value, table_field_display, list_default_value, saved_sql_query;
  • In Form Context: Generates the HTML to display a select field. The rdata type “list” specifies the name of a table from which to get the select box options. If you provide a sqlSavedQuery name it will execute that query instead of the previous parameters to display the content of the list box. The first field returned by the sqlSavedQuery will be the one inserted in the table.
  • In Disp Context: Gets the list values to display from another table using the rdata list.
  • Usage of property list:
  <rdata type=”list”>
     {table name}:{field name to insert in current field}:{field name to display}:{default value}:{ sqlSavedQuery name}
  </rdata>

Example PHP:

 $field = new Fields();
 $field->addField("states", "FieldTypeListBox");
 $field->states->table_name = "states";
 $field->states->table_field_value = "shortname";
 $field->states->table_field_display = "fullname";
 $field->states->label = "States";

Example XML (serialized):

    <rfield name="states">
    <rdata type="list">states:shortname:fullname:0:</rdata>
    <rdata type="label">States</rdata>
    <rdata type="fieldtype">FieldTypeListBox</rdata>
  </rfield>

List Box of Files

  • Radria fieldtype: strFBFieldTypeListBoxFile
  • SQL Type: varchar
  • rdata (options): fieldtype, default, hidden, readonly, label, listfile, ordering, dispalign
  • In Form Context: Generates the HTML to display a select field. It uses the rdata type “list” to specify a directory from which to get the select box options. If you provide a file extension it will show only those files.
  • In Disp Context: Displays the content of the varchar field.
  • Usage of rdata listfile: <rdata type=”listfile”>{directory path}:{file extension}:{default value}</rdata>

Example:

  <rfield name="includefiles">
    <rdata type="listfile">./:.inc.php:</rdata>
    <rdata type="fieldtype">FieldTypeListBoxFile</rdata>
    <rdata type="databasetype">varchar</rdata>
  </rfield>

List Box Small

  • Radria fieldtype: strFBFieldTypeListBoxSmall
  • SQL Type: varchar
  • rdata (options): fieldtype, default, hidden, readonly, label, listvalues, listlabels, ordering, dispalign, emptydefault.
  • In Form Context: Generates the HTML to display a select field. It uses the rdata type “listvalues” and “listlabels” for the content of the select box. This type is usefull for small list boxes.
  • In Disp Context: Displays the content of the varchar field.
  • Usage of rdata listfile:

<rdata type=”listvalues”>{value1}:{value2}:{value3}</rdata>

   <rdata type=”listlabels”>{label1}:{label2}:{label3}</rdata>

Example:

  <rfield name="typeperiode">
    <rdata type="listvalues">D:W:M:Y</rdata>
    <rdata type="listlabels">Day:Week:Month:Year</rdata>
    <rdata type="fieldtype">FieldTypeListBoxSmall</rdata>
    <rdata type="databasetype">varchar</rdata>
    <rdata type="emptydefault">no</rdata>
  </rfield>

Login

  • Radria fieldtype: strFBFieldTypeLogin
  • SQL Type: varchar
  • rdata (options): fieldtype, default, hidden, readonly, label, access, ordering, dispalign, execute
  • In Form Context: Generates an HTML input text field and adds the event-action mydb.checkUsernamePassword that verifies that the value entered doesn't match a username already in the current table.
  • In Disp Context: Displays the content of the varchar field.
  • Usage of rdata access: <rdata type=”access”>{string login or password}</rdata>

Example:

  <rfield name="username">
    <rdata type="label">Username</rdata>
    <rdata type="access">login</rdata>
    <rdata type="textline">20:40</rdata>
    <rdata type="fieldtype">FieldTypeLogin</rdata>
    <rdata type="databasetype">varchar</rdata>
  </rfield>

Password

  • Radria fieldtype: strFBFieldTypePassword
  • SQL Type: varchar
  • rdata (options): fieldtype, default, hidden, readonly, label, access, ordering, dispalign, execute
  • In Form Context: Generates the HTML for two input pasword fields, and adds the event-action mydb.checkUsernamePassword that verifies that both password values are identical.
  • In Disp Context: Displays the content of the varchar field.
  • Usage of rdata access: <rdata type=”access”>{string login or password}</rdata>

Example:

  <rfield name="password">
    <rdata type="label">Password</rdata>
    <rdata type="access">password</rdata>
    <rdata type="fieldtype">FieldTypePassword</rdata>
    <rdata type="databasetype">varchar</rdata>
  </rfield>

Radio Buttons

  • Radria fieldtype: strFBFieldTypeRadioButton
  • SQL Type: varchar
  • rdata (options): fieldtype, default, hidden, readonly, label, radiobutton, ordering, dispalign
  • In Form Context: Generates the HTML to display a list of radio button fields. It uses the rdata radiobutton to get the radio button field values and labels from another field and display them.
  • In Disp Context: Gets the value to display from another table using the rdata radiobutton.
  • Usage of rdata radiobutton: <rdata type=”radiobutton”>{table name}:{table field name to display}:{table field name to insert in current field}:{default value}</rdata>

Example:

  <rfield name="answer">
    <rdata type="label">Select one answer</rdata>
    <rdata type="fieldtype">FieldTypeRadioButton</rdata>
    <rdata type="radiobutton">answers:idanswers:description:</rdata>
    <rdata type="databasetype">varchar</rdata>
  </rfield>

Radio Buttons Small

  • Radria fieldtype: strFBFieldTypeRadioButtonSmall
  • SQL Type: varchar
  • rdata (options): fieldtype, default, hidden, readonly, label, radiovalues, radiolabels, ordering, dispalign, vertical
  • In Form Context: Generates the HTML to display a list of radio buttons. It uses the rdata type “radiovalues” and “radiolabels” for the content of the radio buttons. This type is useful for small radio button lists.
  • In Disp Context: Displays the content of the varchar field.
  • Usage of rdata listfile:
     <rdata type=”radiovalues”>{value1}:{value2}:{value3}</rdata>
     <rdata type=”radiolabels”>{label1}:{label2}:{label3}</rdata>

Example:

  <rfield name="gender">
    <rdata type="radiovalues">M:F</rdata>
    <rdata type="radiolabels">Male:Female</rdata>
    <rdata type="fieldtype">FieldTypeRadioButtonSmall</rdata>
    <rdata type="databasetype">varchar</rdata>
  </rfield>

MultilineText (Text Area)

  • Radria fieldtype: strFBFieldTypeText
  • SQL Type: text
  • rdata (options): default, hidden, readonly, wrap, label, textarea, html, ordering, dispalign, disabled, execute, substring
  • In Form Context: The text area will generate the HTML code to create a textarea field. If there is a label in the rdata htmleditor a link to the htmleditor is displayed (required in the htmleditor package).
  • In Disp Context: Displays the content of the text field. If rdata html is set to 1 all of the HTML code will be displayed.
  • Usage of rdata textarea: <rdata type=“cols”>{cols}</rdata><rdata type=“rows”>{lines}</rdata>

Example:

  <rfield name="comments">
    <rdata type="label">Your Comments</rdata>
    <rdata type="substring">50</rdata>
    <rdata type="rows">10</rdata>
    <rdata type="cols">50</rdata>
    <rdata type="html">1</rdata>
    <rdata type="fieldtype">FieldTypeText</rdata>
    <rdata type="databasetype">text</rdata>
  </rfield>

unix Date

  • Radria fieldtype: strFBFieldTypeDate
  • SQL Type: integer
  • rdata (options): default, hidden, readonly, label, datef, ordering, dispalign
  • In Form Context: Generates 3 HTML input text fields: Days, Months and Years. Years are 4 characters long. The order of the fields can be set with the rdata datef. Add the event-action mydb.formatDateField that will convert the values to a unix time stamp.
  • In Disp Context: Translates the unix time stamp to the date format set in the rdata datef.
  • Usage of rdata datef: <rdata type=“datef”>{date format m, d, Y separated with / or -}:{string for default value (today):{boolean 1 or 0 to hide the field}</rdata>

Example:

  <rfield name="creationdate">
    <rdata type="label">Document creation date</rdata>
    <rdata type="datef">m/d/Y:today:</rdata>
    <rdata type="fieldtype">FieldTypeDate</rdata>
    <rdata type="databasetype">integer</rdata>
  </rfield>

SQL Date

  • Radria fieldtype: strFBFieldTypeDateSQL
  • SQL Type: date
  • rdata (options): default, hidden, readonly, label, datesql, ordering, dispalign
  • In Form Context: Generates 3 HTML input text fields: Days, Months and Years. Years are 4 characters long. The order of the fields can be set with the rdata datesql. It adds the event-action mydb.formatDateSQLField to check the values and convert them to sql date format.
  • In Disp Context: Translates the default sql date format to the date format set in the rdata datesql.
  • Usage of rdata datesql: <rdata type=“datesql”>{date format m, d, Y separated with / or -}:{string for default value (today):{boolean 1 or 0 to display link to popup calendar}:{boolean 1 or 0 to hide the field}</rdata>

Example:

  <rfield name="invoiceDate">
    <rdata type="label">Invoice Date</rdata>
    <rdata type="datesql">m/d/Y:today::</rdata>
    <rdata type="fieldtype">FieldTypeDateSQL</rdata>
    <rdata type="databasetype">date</rdata>
  </rfield>

SQL Time

  • Radria fieldtype: strFBFieldTypeTimeSQL
  • SQL Type: time
  • rdata (options): default, hidden, readonly, label, timef, ordering, dispalign
  • In Context Form: Generates an HTML input text field, and adds the event-action mydb.formatTimeField to check the values and convert them to sql time format.
  • In Context Disp: Displays the content of the field.
  • Usage of rdata timef : <rdata type=“timef”>{ string for default value : now}:{boolean 0 or 1 to hide the field}</rdata>

Example:

  <rfield name="loginTime">
    <rdata type="timef">now:1</rdata>
    <rdata type="fieldtype">FieldTypeTimeSQL</rdata>
    <rdata type="databasetype">time</rdata>
  </rfield>

All rdata options

access: Used by login and password fields, it can only take the values “password” or “login”. The table must have both fields. Usage : <rdata type=”access”>{string login or password}</rdata>

checkbox: (depreciated) Used by the checkbox type to display the field as a checkbox in a form. It Requires the default rdata for the value that will be inserted when the checkbox is checked. Usage: <rdata type=“checkbox”>{boolean 0 or 1}</rdata>

checked_value: Used in checkbox field type to fill in the content of the checkbox field with a value. Usage: <rdata type=”checked_value”>Yes</rdata>

databasetype: Used by the CRUD functionalities when generating SQL queries to manage the data.

datef: Used by the Unix date type to set the format of the date and whether it is hidden or not. <rdata type=“datef”>{date format m, d, Y separated with / or -}:{string for default value (today):{boolean 1 or 0 to hide the field}</rdata>

default: Default value to put in a field. You can display the content of a global variable with the notation [variablename]. You can also call custom functions [functionname;param1;param2…;paramn]. The function is sent one parameter with all the params in an array. The value returned by the function is the value displayed in the field. Usage: <rdata type=“default”>{[global_variable_name] or string}</rdata> Curently there are 2 default functions that can be called: getparam: That will get the default value from a param in a saved event object. Usage: <rdata type=”default”>[getparam;name_of_the_saved_event;name_of_the_param] getfromarray: That will get the default value from an associative array. Usage: <rdata type=”default”>[getfromarray;name_of_the_array;name_of_the_key] See function call for default values

disabled: Will set the field as disabled, the field will not be submited, and the user cannot access its content but it will be visible. See the disabled property for input fields in HTML documention. Usage: <rdata type=”disabled”>1</rdata>

dispalign: Tells how to align the field in a display context, used by reportTable to align the field within the table cell, default alignement is left. (note: not all report templates implement that rdata option) Usage: <rdata type=”dispalign”>right</rdata> will align the field to the right.

email: Used by the Email field type to trigger the event-action to check the email and display it as a mailto link. Usage: <rdata type=“email”>{boolean 0 or 1}</rdata>

emptydefault: Used by the list box to not add a default empty option value in the selection. Usage: <rdata type=”emptydefault”>no</rdata>

execute: Will let the reports and forms execute the PHP code in the database. By default PHP tags are escaped from the database content. If you turn that flag on (1) all PHP code in text and text area fields will be executed. Usage: <rdata type=”execute”>{boolean 0 or 1</rdata>

hidden: Used by all field types. It hides the field in all contexts and displays only an HTML input hidden field. Usage: <rdata type=”hidden”>{boolean 1 or 0}</rdata>

html: Used by the Text Area Type. If it is set to “1”, the text area will display any html code instead of displaying it's content. Usage <rdata type=”html”>1</rdata>

list: Used by the List Box field type. It specifies the table that contains values for the list. Usage: <rdata type=”list”>{table name}:{table field name to display}:{table field name to insert in current field}:{default value}:{ sqlSavedQuery name}</rdata>

listfile: Used by the List File field type. It specifies the directory name and file extension to select. Usage: <rdata type=”listfile”>{directory path}:{file extension}:{default value}</rdata>

listvalues: Used only by the small listbox to store the values of the drop down, this rdata is optional.

Listlabels: Only used by the small listbox to store the label visible in the drop down, if listvalues is not set they will be used for the value of the field.

label: A text label that is displayed next to the form field or display. Usage: <rdata type=”label”>{string with label}</rdata>

numberformat: Format a number field, display float and integer numbers in human readable format. Works like the number_format() function in PHP, plus a prefix string and postfix string. Usage: <rdata type=”numberformat”>pre_string:number_of_digit:decimal_separator:thousand_separator:post_string</rdata> Exemple: <rdata type=”numberformat”>$:1:.:,:-</rdata> will generate for 54134.342: $54,134.3-

ordering: Will be used by reportTable and reportForm to order the fields. The order is descendant. Usage: <rdata type=”ordering”>20</rdata>

overwrite: It is used for the file field, when set to “no” and 2 files with the same name are uploaded in the same folder, the second file will be renamed with the following: n9_original_file_name. Usage: <rdata type=”overwrite”>no</rdata>

picture: Used by File Field type to get the directory where to upload the files. And optionaly the default file name. Usage: <rdata type=”picture”>{directory name}:{default filename}</rdata>

radiobutton: Used By the Radio Button field type to specify the table that contains the content of each radio button. Usage: <rdata type=”radiobutton”>{table name}:{table field name to display}:{table field name to insert in current field}:{default value}</rdata>

radiovalues: Used only by the small radio button to store the values of the radio buttons, this rdata is optional.

radiolabels: Only used by the radio button small to store the label visible of the radio buttons, if radiovalues is not set they will be used for the value of the fields.

readonly: Used by all field types to show the content of the field only in Disp context. Usage: <rdata type=”readonly”>{boolean 1 or 0}</rdata>

required: Used by all field types, it adds the event-action mydb.checkRequired to make sure that the field is not empty. Usage: <rdata type=”required”>{boolean 1 or 0}</rdata>

showpicture: Used by the File field type to specify if html img tags should be displayed for that file. <rdata type=“showpicture”>{boolean 0 or 1}</rdata>

substring: Used in Text line and text area fields to limit the number of characters displayed. To display only the first 50 characters: <rdata type=”substring”>50</rdata>

textarea: Useg by the text area field type for the cols, lines and wrap type. Usage: <rdata type=“textarea”>{cols}:{lines}:{wrap}</rdata>

textline: Used by one line text and all of the field types that extend it: Floats, numbers, and integer numbers. Usage: <rdata type=“textline”>{display size in caracter}:{maximum number of characters for input}</rdata>

vertical: Used by the radio button, to display them one by line or all on one line. Usage: <rdata type=”vertical”>no</rdata> will display them all in one line.

 
core/registry/field_type.txt · Last modified: 2010/01/05 11:21 by admin
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki