Validate only text inputs.

This commit is contained in:
baldo 2016-05-17 12:02:55 +02:00
parent 4474a212e7
commit 2fb4e9a227

View file

@ -128,7 +128,8 @@ angular.module('ffffng')
var doSubmit = function (node) { var doSubmit = function (node) {
if ($scope.nodeForm.$invalid) { if ($scope.nodeForm.$invalid) {
var firstInvalid = _.filter($element.find('form').find('input'), function (input) { var firstInvalid = _.filter($element.find('form').find('input'), function (input) {
return input.name !== 'leaflet-base-layers' && $scope.nodeForm[input.name].$invalid; return (input.type === 'text' || input.type === 'email')
&& $scope.nodeForm[input.name].$invalid;
})[0]; })[0];
if (firstInvalid) { if (firstInvalid) {
$window.scrollTo(0, $window.pageYOffset + firstInvalid.getBoundingClientRect().top - 100); $window.scrollTo(0, $window.pageYOffset + firstInvalid.getBoundingClientRect().top - 100);