example.yml
1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# This is an example of a yml to auto generate validable forms.
# The base squence list is a hash where the keys are the field names.
# each hash iten has a hash to dedfine it's properties.
# The attributes:
# _: text - friendly name for the user interface - must add to POT file
# mandatory: boolean - obviously
# type: prededfined text - text, textarea, hidden, password, radio, checkbox, select
# val: text or list - the field value
# val-h: text or list - the value for the user interface - must add to POT file
# selected: text or list - the selected field(s) on any list fields
# validate: hash - contais validation information
# You can use variables (wordos inside %...%) where will be replacebe by hash
# values gave to the form generator method.
form:
-
action: bli.rb
method: post
id: registration_form
default_size: 25
- name: {
_: Full Name,
type: text,
mandatory: true,
size: 40,
max_size: 255
}
- login: {
_: Login,
type: text,
mandatory: true,
max_size: 20,
validate: {
min_size: [ 3, "The minimal login size is 3" ],
regexp: [ "^[-_a-z0-9]+$",
"The login can only have lowercase letters, numbers hiphen and undescore. (no spaces!)" ]
}
}
- paswd: {
_: Password,
type: password,
mandatory: true,
validate: {
min_size: 4
}
}
- sex: {
_: Sex,
type: radio,
val: [ M, F ],
val-h: [ Male, Female ]
}
- country: {
_: Living Country,
type: select,
val: %COUNTRY_CODES%,
val-h: %COUNTRY_NAMES%,
selected: BR
}
- butons:
- submit: {
_: Enter,
class: icon_enter
}
- reset: {
_: Reset,
class: icon_clear
}