@@ -345,6 +345,7 @@ let MyForm = {
345
345
badLoad :false , // attempted record load with no return (can happen if access is lost during save)
346
346
badSave :false , // attempted save (data SET) with invalid fields, also updates data fields
347
347
blockInputs :false , // disable all user inputs (used by frontend functions)
348
+ firstLoad :true , // form was not used before
348
349
lastFormId :'' , // when routing occurs: if ID is the same, no need to rebuild form
349
350
loading :false , // form is currently loading, informs sub components when form is ready
350
351
message :null , // form message
@@ -815,12 +816,17 @@ let MyForm = {
815
816
// rebuild form if ID changed
816
817
if ( this . lastFormId !== this . form . id ) {
817
818
this . $store . commit ( 'pageTitle' , this . title ) ;
818
- this . message = null ;
819
- this . showLog = false ;
820
- this . titleOverwrite = null ;
821
- this . lastFormId = this . form . id ;
822
- this . fieldIdsInvalid = [ ] ;
823
- this . fieldIdsTouched = [ ] ;
819
+ this . message = null ;
820
+ this . showLog = false ;
821
+ this . titleOverwrite = null ;
822
+ this . lastFormId = this . form . id ;
823
+
824
+ if ( ! this . firstLoad ) {
825
+ // on first load, field states do not need to be reset
826
+ // addresses issue in which field valid states are set before reset() is executed
827
+ this . fieldIdsInvalid = [ ] ;
828
+ this . fieldIdsTouched = [ ] ;
829
+ }
824
830
825
831
// set preset record to open, if defined
826
832
if ( this . form . presetIdOpen !== null && this . relationId !== null ) {
@@ -833,6 +839,7 @@ let MyForm = {
833
839
834
840
// reset form behaviour and load record
835
841
this . blockInputs = false ;
842
+ this . firstLoad = false ;
836
843
this . fieldIdMapOverwrite = this . getFieldOverwritesDefault ( ) ;
837
844
this . timerClearAll ( ) ;
838
845
this . closePopUp ( ) ;
@@ -982,7 +989,7 @@ let MyForm = {
982
989
this . fieldIdsTouched . push ( fieldId ) ;
983
990
} ,
984
991
fieldSetValid ( state , fieldId ) {
985
- let pos = this . fieldIdsInvalid . indexOf ( fieldId ) ;
992
+ const pos = this . fieldIdsInvalid . indexOf ( fieldId ) ;
986
993
if ( state && pos !== - 1 ) return this . fieldIdsInvalid . splice ( pos , 1 ) ;
987
994
if ( ! state && pos === - 1 ) return this . fieldIdsInvalid . push ( fieldId ) ;
988
995
} ,
0 commit comments