Skip to content
This repository has been archived by the owner on Mar 12, 2020. It is now read-only.

Hi if i want to make more custom validation how can i do it? Like.. #658

Open
pencsi opened this issue Jul 23, 2019 · 2 comments
Open

Hi if i want to make more custom validation how can i do it? Like.. #658

pencsi opened this issue Jul 23, 2019 · 2 comments

Comments

@pencsi
Copy link

pencsi commented Jul 23, 2019

$('form[data-toggle="validator"]').validator({
	custom: {
		nextpay_d: function($el) {
			var n_d = $('#nextpay_d').val();
			var n_m = $('#nextpay_m').val();
			var n = isWeekend(n_d, n_m);
			if (n == 6 || n == 0){
				return "This date falls on the weekend!";
			}
		},
		followpay_d: function($e2) {
			var date1 = new Date();
			var date2 = new Date();
			var n_d = $('#nextnextpay_d').val();
			var n_m = $('#nextnextpay_m').val();
			date2.setMonth(n_m-1, n_d);
			var n = isWeekend(n_d, n_m);
			if (n == 6 || n == 0){
				return "This date falls on the weekend!";
			}elseif(date2 <= date1){
				return "This date must be higher!";
			}
		}
	}
});
@pencsi
Copy link
Author

pencsi commented Jul 23, 2019

But this is not the correct syntax :D pls help meee

@canadauto
Copy link

this looks right to me library is having issues with jquery 3 hence if it doesnt trigger custom its because of that
$('#Form').validator({
custom: {
"invalidnumber": function (data) {
var number = data.attr('data-invalidnumber');
console.log("here");
if (data.val() == number) {
return number + " is not a valid choice";
}
}
}
})

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants