Skip to content

Commit

Permalink
Include country in validation check.
Browse files Browse the repository at this point in the history
  • Loading branch information
iamdharmesh committed Aug 29, 2024
1 parent 6f467aa commit 6964674
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
5 changes: 3 additions & 2 deletions assets/css/create-account.css
Original file line number Diff line number Diff line change
Expand Up @@ -314,12 +314,13 @@
.mailchimp-sf-form-wrapper .box.form-error {
color: red;
}
.mailchimp-sf-form-wrapper .box.form-error p {
.mailchimp-sf-form-wrapper .box.form-error p.error-field {
margin-bottom: 0px;
font-size: 14px;
}

.mailchimp-sf-form-wrapper .box.form-error input {
.mailchimp-sf-form-wrapper .box.form-error input,
.mailchimp-sf-form-wrapper .box.form-error select {
border-color: red;
}

Expand Down
3 changes: 2 additions & 1 deletion assets/js/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@
'business_name',
'email',
'address',
'country',
'city',
'state',
'zip',
Expand Down Expand Up @@ -234,7 +235,7 @@
const inputIds = Object.keys(errors);

inputIds.forEach((key) => {
const inputElementId = `${wrapperId} input#${key}`;
const inputElementId = `${wrapperId} #${key}`;
const errorElementId = `${wrapperId} #mailchimp-sf-${key}-error`;

if (errors[key] !== null) {
Expand Down
2 changes: 2 additions & 0 deletions includes/admin/templates/create-account-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,14 @@
</label>
<div class="mailchimp-select-wrapper">
<select id="country" name="country" required>
<option value="" selected="selected"><?php esc_html_e( 'Please select a country', 'mailchimp' ); ?></option>
<?php
foreach ( $countries as $key => $value ) {
echo '<option value="' . esc_attr( $key ) . '">' . esc_html( $value ) . '</option>';
}
?>
</select>
<p id="mailchimp-sf-country-error" class="error-field"></p>
</div>
</div>
</div>
Expand Down

0 comments on commit 6964674

Please sign in to comment.