@yisrael-wix I’m using a custom update function. The user has 3 fields to input first, last and email. A fourth field (drop down) to select a company. A 5th field that autogenerates a drop down based on the selection in the 4th field. Finally, an upload button to submit an image.
All is working fine for 78 of the 79 submissions so far. This is an open site, no members or user login. It just seems random or a user having some privacy settings, old browser or something? I can’t figure it out. I thought maybe it was a timing issue that it tool longer than expected to upload the image before my form reset function kicked in and cleared these values. But this would be crazy coincidental to reset only these 3 fields. Could this be the culprit? If so, any suggestions on where to put the reset function?
Here is my code for the submission button of the page:
export function writeData () {
let dateTime = new Date ();
wixData . get ( “FoundersAccts” , $w ( “#acctdropdown” ). value )
. then (( item ) => {
item . lastName = $w ( “#last” ). value ; // updated last name
item . firstName = $w ( “#first” ). value ;
item . email = $w ( “#UserEmail” ). value . toLowerCase ();
item . display = url ; //$w(“#image11”).src;
item . fullAddress = item . address + " " + item . city + ", " + item . state + " " + item . zip ;
item . submittedDate = dateTime ;
wixData . update ( “FoundersAccts” , item );
})
. catch (( err ) => {
let errorMsg = err ;
});
setTimeout (() => {
resetForm ();
}, 3000 )
I should also include the error check code that driving the upload file button. Here is where I’m checking field validity. Again, this is working on every device I try but some user out there is getting through:
export function submitDropdown () {
if ( $w ( “#uploadDisplay” ). value . length > 0 &&
$w ( ‘#first’ ). valid &&
$w ( ‘#acctdropdown’ ). valid &&
$w ( ‘#last’ ). valid &&
$w ( ‘#distributor’ ). valid &&
$w ( ‘#UserEmail’ ). value . includes ( “@” ))
{
$w ( “#text25” ). hide ();
$w ( ‘#text29’ ). show ();
$w ( “#text29” ). text = "Uploading " + $w ( “#uploadDisplay” ). value [ 0 ]. name ;
$w ( “#uploadDisplay” ). startUpload ()
. then (( uploadedFile ) => {
$w ( “#text24” ). show ();
$w ( ‘#text29’ ). hide ();
url = uploadedFile . url ;
console . log ( "acctdropdown Id: " + $w ( “#acctdropdown” ). value );
writeData (); //updates current record
})
. catch (( uploadError ) => {
$w ( “#text25” ). show ();
console . log ( "File upload error: " + uploadError . errorCode );
});
} else {
$w ( “#text25” ). show ();
console . log ( “something is not valid” );
$w ( “#first” ). resetValidityIndication ()
$w ( “#first” ). updateValidityIndication ()
$w ( “#first” ). placeholder = $w ( “#first” ). validationMessage ;
$w ( "#last" ). resetValidityIndication ()
$w ( "#last" ). updateValidityIndication ()
$w ( "#last" ). placeholder = $w ( "#last" ). validationMessage ;
$w ( "#UserEmail" ). resetValidityIndication ()
$w ( "#UserEmail" ). updateValidityIndication ()
$w ( "#UserEmail" ). placeholder = "Please enter a valid email address" ;
$w ( "#distributor" ). resetValidityIndication ();
$w ( "#distributor" ). updateValidityIndication ();
$w ( "#distributor" ). placeholder = $w ( "#distributor" ). validationMessage ;
$w ( "#acctdropdown" ). resetValidityIndication ()
$w ( "#acctdropdown" ). updateValidityIndication ()
$w ( "#acctdropdown" ). placeholder = $w ( "#acctdropdown" ). validationMessage ;
$w ( "#uploadDisplay" ). resetValidityIndication ()
$w ( "#uploadDisplay" ). updateValidityIndication ()
}
}