File tree Expand file tree Collapse file tree 2 files changed +4
-14
lines changed Expand file tree Collapse file tree 2 files changed +4
-14
lines changed Original file line number Diff line number Diff line change 299299 validateForm ( sender , onlyCheck = false ) {
300300 let form = sender . form ?? sender , scope ;
301301 this . formErrors = [ ] ;
302- if ( form [ 'nette-submittedBy' ] && form [ 'nette-submittedBy' ] . getAttribute ( 'formnovalidate' ) !== null ) {
303- let scopeArr = JSON . parse ( form [ 'nette-submittedBy' ] . getAttribute ( 'data-nette-validation-scope' ) ?? '[]' ) ;
302+ if ( sender . getAttribute ( 'formnovalidate' ) !== null ) {
303+ let scopeArr = JSON . parse ( sender . getAttribute ( 'data-nette-validation-scope' ) ?? '[]' ) ;
304304 if ( scopeArr . length ) {
305305 scope = new RegExp ( '^(' + scopeArr . join ( '-|' ) + '-)' ) ;
306306 }
519519 }
520520 form . noValidate = true ;
521521 form . addEventListener ( 'submit' , ( e ) => {
522- if ( ! this . validateForm ( form ) ) {
522+ if ( ! this . validateForm ( form . submitter || form ) ) {
523523 e . stopPropagation ( ) ;
524524 e . preventDefault ( ) ;
525525 }
532532 this . #onDocumentReady( ( ) => {
533533 Array . from ( document . forms )
534534 . forEach ( ( form ) => this . initForm ( form ) ) ;
535- document . body . addEventListener ( 'click' , ( e ) => {
536- let target = e . target ;
537- while ( target ) {
538- if ( target . form && target . type in { submit : 1 , image : 1 } ) {
539- target . form [ 'nette-submittedBy' ] = target ;
540- break ;
541- }
542- target = target . parentNode ;
543- }
544- } ) ;
545535 } ) ;
546536 }
547537 }
You can’t perform that action at this time.
0 commit comments