Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit 0fb2c56

Browse files
committed
Merge pull request #367 from appirio-tech/feature/tom-address/validation
updated address validation
2 parents a4977b1 + f451f89 commit 0fb2c56

File tree

2 files changed

+27
-6
lines changed

2 files changed

+27
-6
lines changed

app/settings/account-info/account-info.jade

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,13 @@
9595
placeholder="123 Topcoder Ave.",
9696
value="{{vm.homeAddress.streetAddr1}}",
9797
ng-model="vm.homeAddress.streetAddr1",
98-
ng-class="{'form-field-focused': hasFocus==true}"
98+
ng-class="{'form-field-focused': hasFocus==true}",
99+
ng-required="vm.addressDirty = vm.accountInfoForm.address.$dirty || vm.accountInfoForm.city.$dirty || vm.accountInfoForm.state.$dirty || vm.accountInfoForm.zipcode.$dirty || vm.accountInfoForm.country.$dirty"
99100
)
100101

102+
.account-info-error(ng-show="vm.addressDirty && vm.accountInfoForm.address.$invalid")
103+
p(ng-show="vm.accountInfoForm.address.$error.required") Please enter an address
104+
101105
.form-label Address 2
102106
span(style="text-transform: none;")  (opt., suite, etc.)
103107
input.form-field(
@@ -115,27 +119,39 @@
115119
value="{{vm.homeAddress.city}}",
116120
placeholder="Best City in the World",
117121
ng-model="vm.homeAddress.city",
118-
ng-class="{'form-field-focused': hasFocus==true}"
122+
ng-class="{'form-field-focused': hasFocus==true}",
123+
ng-required="vm.addressDirty"
119124
)
120125

126+
.account-info-error(ng-show="vm.addressDirty && vm.accountInfoForm.city.$invalid")
127+
p(ng-show="vm.accountInfoForm.city.$error.required") Please enter a city
128+
121129
.form-label State/Province
122130
input.form-field(
123131
name="state", type="text",
124132
value="{{vm.homeAddress.stateCode}}",
125133
placeholder="California",
126134
ng-model="vm.homeAddress.stateCode",
127-
ng-class="{'form-field-focused': hasFocus==true}"
135+
ng-class="{'form-field-focused': hasFocus==true}",
136+
ng-required="vm.addressDirty"
128137
)
129138

139+
.account-info-error(ng-show="vm.addressDirty && vm.accountInfoForm.state.$invalid")
140+
p(ng-show="vm.accountInfoForm.state.$error.required") Please enter a state or province
141+
130142
.form-label Zip
131143
input.form-field(
132144
name="zipcode", type="text",
133145
placeholder="Zip"
134146
value="{{vm.homeAddress.zip}}",
135147
ng-model="vm.homeAddress.zip",
136-
ng-class="{'form-field-focused': hasFocus==true}"
148+
ng-class="{'form-field-focused': hasFocus==true}",
149+
ng-required="vm.addressDirty"
137150
)
138151

152+
.account-info-error(ng-show="vm.addressDirty && vm.accountInfoForm.zipcode.$invalid")
153+
p(ng-show="vm.accountInfoForm.zipcode.$error.required") Please enter a zip
154+
139155
.form-label Country
140156
angucomplete-alt(
141157
input-name="country",
@@ -148,9 +164,10 @@
148164
title-field="name",
149165
match-class="angucomplete-highlight",
150166
minlength="1",
151-
ng-class="{'form-field-focused': hasFocus==true}"
167+
ng-class="{'form-field-focused': hasFocus==true}",
168+
field-required="vm.addressDirty"
152169
)
153-
.account-info-error(ng-show="vm.accountInfoForm.country.$invalid")
170+
.account-info-error(ng-show="vm.addressDirty && vm.accountInfoForm.country.$error.required")
154171
p(ng-show="vm.accountInfoForm.country.$error.required") Please choose a country from the list.
155172

156173

assets/css/settings/account-info.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
.account-info-container {
55
padding-bottom: 75px;
66

7+
.account-info-error {
8+
color: #ef3a3a;
9+
}
10+
711
.section-fields {
812
margin-top: 20px;
913
}

0 commit comments

Comments
 (0)