You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

pd-forms

Package Overview
Dependencies
Maintainers
3
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pd-forms - npm Package Compare versions

Comparing version

to
4.1.0

2

package.json

@@ -5,3 +5,3 @@ {

"description": "Customization of netteForms for use in PeckaDesign.",
"version": "4.0.1",
"version": "4.1.0",
"author": "PeckaDesign, s.r.o <support@peckadesign.cz>",

@@ -8,0 +8,0 @@ "contributors": [

/**
* @name pdForms
* @author Radek Šerý <radek.sery@peckadesign.cz>
* @version 4.0.1
* @version 4.1.0
*

@@ -160,3 +160,3 @@ * Features:

validate.forEach(function(elem) {
if (elem.getAttribute('data-pdforms-ever-focused')) {
if (elem.getAttribute('data-pdforms-ever-focused') || elem.value !== '') {
// assumes the input is valid, therefore removing all messages except those associated with ajax rules; this

@@ -599,2 +599,27 @@ // prevents flashing of message, when ajax rule is evaluated - ajax rules removes their messages when the ajax

/**
* Scroll into first error after validation.
*/
pdForms.afterValidationScroll = function (form, firstErrorElem) {
if (! firstErrorElem) {
form.scrollIntoView();
return;
}
var placeholder = pdForms.getMessagePlaceholder(firstErrorElem)
if (placeholder.isGlobal || firstErrorElem.type === 'hidden') {
(placeholder.elem ?? form).scrollIntoView()
firstErrorElem.focus({
preventScroll: true
});
return;
}
firstErrorElem.focus()
}
/**
* Optional rules are defined using "optional" property in "arg". We have to convert arg into Nette format before

@@ -649,4 +674,4 @@ * validating. This means removing all properties but data from arg and storing them elsewhere.

if (focusElem) {
focusElem.focus();
if (errors.length) {
pdForms.afterValidationScroll(form, focusElem);
}

@@ -653,0 +678,0 @@ };