csv

Description

Wpart responsible for entering CSV (Common Separated Values) data. During the validation phase data is split by delimiter and passed to the lower level (basic elements) validators. All elements of the field must be of the same type. The type of the elements is described by type parameter.

For example, if we want to add a new attribute describing our model, let's say tags, that will hold the list of the same data, we can use wpart_csv for that. The data retrieved from the form will be tokenized and stored in the database as a list of values.

The rendered widget is <input type="text" ... />.

Additional parameters

parameter

format

description

type

type where type :: atom()

Specifies the type of the elements of the CSV field.

Validation

option

format

description

error message

the same as in type type

HTML meta-attributes

name

format

description

delimiter

"Delimiter"

Sets the delimiter which separates the values typed in the field. By default it is set to , (comma).

Examples

Records definitions

Parameters are the same as in type type.

The additional one is delimiter:

...
{csv, [{delimiter, "|"},
       {type, string},
       {max_length, 5},
       %% other parameters
      ]
},
...

HTML tag

<wpart:csv delimiter="|" OTHER_HTML_ATTRIBUTES />

Wparts/BasicTypes/csv (last edited 2009-02-13 11:40:40 by Michal Ptaszek)