NetTalk Central

Author Topic: Uploaded file variable gets cleared when errors on form  (Read 4606 times)

peterH

  • Sr. Member
  • ****
  • Posts: 413
    • View Profile
Uploaded file variable gets cleared when errors on form
« on: March 08, 2019, 03:30:28 AM »
I have a memory form with a bunch of local fields - some for user input and some for file upload. All fields are primed to blank/0.

The problem is that when the user clicks save and there's an error on one of the input fields, then the vars holding the already uploaded file(s) get cleared and the user has to select/upload again.

Any way to overcome this?

Peter

C11/NT11.07

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: Uploaded file variable gets cleared when errors on form
« Reply #1 on: March 08, 2019, 04:47:28 AM »
I'd need an example to play with Peter....

peterH

  • Sr. Member
  • ****
  • Posts: 413
    • View Profile
Re: Uploaded file variable gets cleared when errors on form
« Reply #2 on: March 25, 2019, 08:37:34 AM »
Hi Bruce,

My original description was not correct. The local var does retain its value but the upload box (as displayed by the file upload script) is being reset/cleared, which this makes the user think that the file has not been selected/uploaded.

I've sent you an example.

Peter

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: Uploaded file variable gets cleared when errors on form
« Reply #3 on: March 26, 2019, 11:25:54 PM »
thanks for the example peter, by way of closing the thread here was my response;


So the problem you're seeing here is that the page is refreshed when the form is invalidated.
Refreshing the page results in the File Upload field being refreshed.
 
So, I think what you want to do is add "more fields". Basically you want a display field which shows the name of files already uploaded.
If you show the name, then it's there for the refresh ? and also if the user edit's the record.

cheers
Bruce