-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
65 lines (60 loc) · 2.01 KB
/
index.php
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
<?php
use Bittr\Form;
require 'src/Form.php';
$name = 'rand';
$attributes_arr = [
'class' => 'form-class',
'id' => 'form-id',
'pl' => 'Placeholder'
];
$options = [
'Volvo',
'Saab',
'Audi'
];
$selected = 'Saab';
$disabled = ['Audi'];
$max_size = 0;
$source = 'source';
$content = 'Content';
$value = 10;
$max_val = 100;
$label = true; // show label.
echo (new Form('index.php'))
->persistWith($_POST) // data to repopulate
->shortTags(['pl' => 'placeholder']) // replace all pl in element attribute as placeholder
->checkbox($name, $attributes_arr, 'Check')
->hidden($name, $attributes_arr)
->email('email_address', $attributes_arr, $label)->val('foo@bar.com')
->password($name, $attributes_arr, $label)
->text($name, $attributes_arr, $label)
->color($name, $attributes_arr, $label)
->date($name, $attributes_arr, $label)
->datetimeLocal($name, $attributes_arr, $label)
->file($name, $attributes_arr, $max_size)
->image($name, $source, $attributes_arr, $label)
->month($name, $attributes_arr, $label)
->number($name, $attributes_arr, $label)
->radio($name, $attributes_arr, 'Click')
->range($name, $attributes_arr, $label)
->reset($attributes_arr)
->search($name, $attributes_arr, $label)
->tel($name, $attributes_arr, $label)
->time($name, $attributes_arr, $label)
->url($name, $attributes_arr, $label)
->week($name, $attributes_arr, $label)
->select($name, Form::MONTH, $attributes_arr, $label)
->datalist($name, range(1, 10), $attributes_arr)
->textarea($name, $attributes_arr, $label)
->output($name, $attributes_arr, $label)
->repeatable(2, function (Form $form) {
$form->html('<div class="sdsd">')
->text('name[]')
->select('range[]', range(1, 3), [], true, true)
->html('</div>');
})
->label('custom', 'your custom input')
->text('remove')
->progress($value, $max_val)->move('email_address')
->remove('remove')
->bSubmit("Submit");