Skip to content

Commit 348c094

Browse files
committed
Don't submit form on empty required fields
1 parent fda1ee1 commit 348c094

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

public/js/paystack-forms-public.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,13 @@
147147
$(this).find("#pf-email").addClass('rerror');//.css({ "border-color":"red" });
148148
$('html,body').animate({ scrollTop: $('.rerror').offset().top - 110 }, 500);
149149
return false;
150+
stop = true;
150151
}
151152
$(this).find("input, select, textarea").filter("[required]").filter(function() { return this.value == ''; }).each(function() {
152153
$(this).addClass('rerror');
153154
$('html,body').animate({ scrollTop: $('.rerror').offset().top - 110 }, 500);
154155
return false;
156+
stop = true;
155157
});
156158
if($('#pf-agreement').length){
157159
if($("#pf-agreement").is(':checked')){
@@ -167,6 +169,11 @@
167169
}
168170

169171
}
172+
if (stop) {
173+
$('html,body').animate({ scrollTop: $('.rerror').offset().top - 110 }, 500);
174+
return false;
175+
176+
}
170177

171178

172179

0 commit comments

Comments
 (0)