This repository was archived by the owner on Jun 27, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +26
-0
lines changed Expand file tree Collapse file tree 5 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -115,6 +115,7 @@ const data = () => ({
115115 label: ' Website' ,
116116 name: ' website' ,
117117 customClass: ' col-12' ,
118+ helper: ' Pstt... psst, this is a hint' ,
118119 validations: [new FormValidation (url, ` Format of Url is incorrect` )],
119120 }),
120121 new FormField ({
Original file line number Diff line number Diff line change @@ -17,6 +17,9 @@ export function FormField({
1717 options = [],
1818 placeholder = null ,
1919 inline = false ,
20+ rows = null ,
21+ cols = null ,
22+ helper,
2023}) {
2124 this .id = id;
2225 this .type = type;
@@ -29,6 +32,9 @@ export function FormField({
2932 this .options = options;
3033 this .placeholder = placeholder;
3134 this .inline = inline;
35+ this .rows = rows;
36+ this .cols = cols;
37+ this .helper = helper;
3238}
3339```
3440
@@ -43,17 +49,22 @@ export function FormControl({
4349 value = null ,
4450 validations = [],
4551 label = null ,
52+ form,
4653 name = null ,
4754 customClass = null ,
4855 options = [],
4956 placeholder = null ,
57+ rows = null ,
58+ cols = null ,
5059 errors = {},
5160 valid = true ,
5261 touched = false ,
5362 dirty = false ,
63+ helper,
5464}) {
5565 this .id = id || ` ${ form} -${ name} ` ;
5666 this .type = type;
67+ this .form = form;
5768 this .value = value;
5869 this .validations = validations;
5970 this .label = label;
@@ -65,5 +76,8 @@ export function FormControl({
6576 this .valid = valid;
6677 this .touched = touched;
6778 this .dirty = dirty;
79+ this .rows = rows;
80+ this .cols = cols;
81+ this .helper = helper;
6882}
6983```
Original file line number Diff line number Diff line change 4545 :onFocus =" onFocus"
4646 :onBlur =" onBlur"
4747 />
48+ <p class =" form-hint" v-if =" formControl.helper" >
49+ {{ formControl.helper }}
50+ </p >
4851 <div v-if =" showErrors" >
4952 <p
5053 v-for =" (errorText, $index) in errorMessages"
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ export function FormControl({
1515 valid = true ,
1616 touched = false ,
1717 dirty = false ,
18+ helper,
1819} ) {
1920 this . id = id || `${ form } -${ name } ` ;
2021 this . type = type ;
@@ -32,6 +33,7 @@ export function FormControl({
3233 this . dirty = dirty ;
3334 this . rows = rows ;
3435 this . cols = cols ;
36+ this . helper = helper ;
3537}
3638
3739export function FormField ( {
@@ -48,6 +50,7 @@ export function FormField({
4850 inline = false ,
4951 rows = null ,
5052 cols = null ,
53+ helper,
5154} ) {
5255 this . id = id ;
5356 this . type = type ;
@@ -62,6 +65,7 @@ export function FormField({
6265 this . inline = inline ;
6366 this . rows = rows ;
6467 this . cols = cols ;
68+ this . helper = helper ;
6569}
6670
6771export function FormValidation (
Original file line number Diff line number Diff line change @@ -27,6 +27,10 @@ $input-error-color: #dc3545;
2727 margin-bottom : 0.5rem ;
2828}
2929
30+ .form-hint {
31+ font-size : 12px ;
32+ }
33+
3034.form-group {
3135 width : 100% ;
3236 margin-bottom : 1rem ;
You can’t perform that action at this time.
0 commit comments