Add email validation regex setting!
This commit is contained in:
1 parent
ee94cdec5a
commit
e7aafff59b
9 files changed
+94
-6
No files matched your search
@@ -74,5 +74,29 @@
|
||||
}
|
||||
}
|
||||
})
|
||||
$(document).ready(function(){
|
||||
var email_regex = "{{email_regex}}";
|
||||
if(email_regex.length != 0){
|
||||
email_regex = new RegExp(email_regex);
|
||||
var submit_flag = false;
|
||||
$(".ask-question-form").each(function(i, form){
|
||||
var $form = $(form);
|
||||
if($form.length != 0 && $form.find('#ask_question_mail').length != 0){
|
||||
$form.submit(function(){
|
||||
if(!submit_flag){
|
||||
submit_flag = true;
|
||||
if(email_regex.test($form.find('#ask_question_mail').val())){
|
||||
submit_flag = false;
|
||||
}else{
|
||||
alert("<%=t('ask.please_check_email_format')%>");
|
||||
submit_flag = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
</script>
|
||||
</div>
|
||||
Reference in new issue
Block a user