Skip to content

Commit 58c3d78

Browse files
update
1 parent b3df270 commit 58c3d78

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

tests/index_get.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"email|email" => 'Please enter a valid email address',
2121
"int:age" => 'Age is required',
2222
"int:age:<:16" => 'Sorry! you must be 16yrs and above to use this site',
23+
"array:activities" => 'Select one or more activities',
2324
])->save(function($response){
2425
// access the form data
2526
$param = $response->param;
@@ -34,16 +35,11 @@
3435
$param->email,
3536
$param['name'],
3637
$attribute->occupation,
37-
// $response
38+
$param->activities
3839
);
3940

4041
// var_dump( $response->getForm() );
4142
});
42-
43-
// dd(
44-
// old('activities.swimming')
45-
// );
46-
4743

4844
?>
4945

@@ -80,7 +76,7 @@
8076

8177
<div class="">
8278
<label for="html">Age</label>
83-
<input type="text" name="age" value="<?= old('age'); ?>">
79+
<input type="number" name="age" value="<?= old('age'); ?>">
8480
</div>
8581

8682
<div class="activities">
@@ -90,11 +86,11 @@
9086

9187
<label for="reading">
9288
Reading
93-
<input type="checkbox" name="activities[]" value="reading" id="reading" <?= isset(old('activities')['reading']) ? 'checked' : '' ?> >
89+
<input type="checkbox" name="activities[]" value="reading" id="reading" <?= old('activities.reading') ? 'checked' : '' ?> >
9490
</label>
9591
<label for="writing">
9692
Writing
97-
<input type="checkbox" name="activities[]" value="writing" id="writing" <?= isset(old('activities')['writing']) ? 'checked' : '' ?>>
93+
<input type="checkbox" name="activities[]" value="writing" id="writing" <?= old('activities.writing') ? 'checked' : '' ?>>
9894
</label>
9995
<label for="running">
10096
Running

tests/index_post.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
dump(
2323
$param,
24-
$response->param
24+
$response->param->toObject()
2525
);
2626
});
2727

@@ -60,7 +60,7 @@
6060

6161
<div class="">
6262
<label for="html">Age</label>
63-
<input type="text" name="age" value="<?= $form->old('age'); ?>">
63+
<input type="number" name="age" value="<?= $form->old('age'); ?>">
6464
</div>
6565

6666
<button type="submit" class="btn mt-2">Submit</button>

tests/index_text3.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ class: [
3535
})->after(function(){
3636

3737
print_r("**after Submit usage example** <br>");
38-
})->save(function($response) use ($outsideParam){
38+
})
39+
->save(function($response) use ($outsideParam){
3940
// access the form data
4041
$param = $response->param;
4142

0 commit comments

Comments
 (0)