Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
boco-frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
idatt2106_2022_02
boco-frontend
Commits
164cf9f2
Commit
164cf9f2
authored
3 years ago
by
Titus Netland
Browse files
Options
Downloads
Patches
Plain Diff
Validate errors showing in register
parent
bdd0391c
No related branches found
No related tags found
2 merge requests
!70
Component update 2
,
!68
Component update
Pipeline
#178755
failed
3 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/components/FormComponents/RegisterForm.vue
+87
-13
87 additions, 13 deletions
src/components/FormComponents/RegisterForm.vue
with
87 additions
and
13 deletions
src/components/FormComponents/RegisterForm.vue
+
87
−
13
View file @
164cf9f2
...
...
@@ -13,15 +13,43 @@
type=
"email"
placeholder=
"E-post adresse"
/>
<!-- error message -->
<div
class=
"text-red-600 text-sm"
v-for=
"(error, index) of v$.email.$errors"
:key=
"index"
>
<div
class=
"text-red-600 text-sm"
v-show=
"showError"
id=
"emailErrorId"
>
{{
error
.
$message
}}
</div>
</div>
</div>
<div
class=
"w-full"
>
<div>
<input
class=
"block w-full px-4 py-2 mt-2 text-gray-700 placeholder-gray-500 bg-white border rounded-md dark:bg-gray-800 dark:border-gray-600 dark:placeholder-gray-400 focus:border-blue-400 dark:focus:border-blue-300 focus:ring-opacity-40 focus:outline-none focus:ring focus:ring-blue-300"
v-model=
"password"
id=
"password"
type=
"password"
placeholder=
"Passord"
/>
<!-- error message -->
<div
class=
"text-red-600 text-sm"
v-for=
"(error, index) of v$.password.$errors"
:key=
"index"
>
<div
class=
"text-red-600 text-sm"
v-show=
"showError"
id=
"passwordErrorId"
>
{{
error
.
$message
}}
</div>
</div>
</div>
<div>
...
...
@@ -31,6 +59,20 @@
type=
"password"
placeholder=
"Bekreft passord"
/>
<!-- error message -->
<div
class=
"text-red-600 text-sm"
v-for=
"(error, index) of v$.confirmPassword.$errors"
:key=
"index"
>
<div
class=
"text-red-600 text-sm"
v-show=
"showError"
id=
"confirmPasswordErrorId"
>
{{
error
.
$message
}}
</div>
</div>
</div>
<div>
...
...
@@ -41,6 +83,20 @@
type=
"text"
placeholder=
"Fornavn"
/>
<!-- error message -->
<div
class=
"text-red-600 text-sm"
v-for=
"(error, index) of v$.firstName.$errors"
:key=
"index"
>
<div
class=
"text-red-600 text-sm"
v-show=
"showError"
id=
"firstNameErrorId"
>
{{
error
.
$message
}}
</div>
</div>
</div>
<div>
...
...
@@ -50,6 +106,20 @@
type=
"text"
placeholder=
"Etternavn"
/>
<!-- error message -->
<div
class=
"text-red-600 text-sm"
v-for=
"(error, index) of v$.lastName.$errors"
:key=
"index"
>
<div
class=
"text-red-600 text-sm"
v-show=
"showError"
id=
"lastNameErrorId"
>
{{
error
.
$message
}}
</div>
</div>
</div>
<div>
...
...
@@ -59,6 +129,20 @@
type=
"text"
placeholder=
"Adresse"
/>
<!-- error message -->
<div
class=
"text-red-600 text-sm"
v-for=
"(error, index) of v$.address.$errors"
:key=
"index"
>
<div
class=
"text-red-600 text-sm"
v-show=
"showError"
id=
"addressErrorId"
>
{{
error
.
$message
}}
</div>
</div>
</div>
</div>
...
...
@@ -67,16 +151,6 @@
</div>
</form>
</div>
<ul
data-test=
"errorMessageList"
>
<li
v-if=
"errorMessage"
data-test=
"customErrorMsg"
>
{{
errorMessage
}}
</li>
<li
v-for=
"error of v$.$errors"
:key=
"error.$uid"
>
<!--
{{
error
.
$validator
}}
-->
Field
{{
error
.
$property
}}
has error:
{{
error
.
$message
}}
</li>
</ul>
</
template
>
<
script
>
...
...
@@ -95,8 +169,8 @@ export default {
setup
:
()
=>
({
v
$
:
useVuelidate
()
}),
data
()
{
return
{
showError
:
false
,
errorMessage
:
""
,
loading
:
false
,
email
:
""
,
password
:
""
,
confirmPassword
:
""
,
...
...
@@ -125,7 +199,7 @@ export default {
methods
:
{
async
submit
()
{
//Display loading symbol
this
.
loading
=
true
;
this
.
showError
=
true
;
//Validate form
const
result
=
await
this
.
v$
.
$validate
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment