NetTalk Central

Author Topic: Browse won't refresh from file upload, if on child form...  (Read 4872 times)

Niels Larsen

  • Sr. Member
  • ****
  • Posts: 420
    • View Profile
    • Email
Browse won't refresh from file upload, if on child form...
« on: July 19, 2019, 11:02:23 PM »
Hi Bruce

I have a form on a form. On the child form I have an File Upload field, inserting the files in a table, and then showed in an updated browse.
The outer form has the "Generate <form> tag" ON and the inner is OFF.
If I "run" the inner form everything works fine, but from the outer form the browse doesn't refresh.
Attached is an example.
I know the app doesn't make sense -  just to illustrate the problem.

Regards Niels

Johan de Klerk

  • Full Member
  • ***
  • Posts: 216
  • Johan de Klerk
    • View Profile
    • Designer Software
Re: Browse won't refresh from file upload, if on child form...
« Reply #1 on: July 20, 2019, 12:20:29 AM »
Hi Niels,

Bruce posted this: the "outer form" can have the <form> tag, so the "inner" form must have the "generate <form> tag" option off.
In this thread: https://www.nettalkcentral.com/forum/index.php?topic=8245.0

Maybe this is your problem.

Regards

Johan de Klerk
Clarion 10, NT 11.57

Niels Larsen

  • Sr. Member
  • ****
  • Posts: 420
    • View Profile
    • Email
Re: Browse won't refresh from file upload, if on child form...
« Reply #2 on: July 20, 2019, 01:13:49 AM »
Hi Johan

I'm aware of that. My outer form is ON and the inner is OFF.
I have tried other combinations, but it makes no difference.
But thanks anyway. Always nice when someone suggests a solution.

Regards Niels

DonRidley

  • Don Ridley
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 729
  • donaldridley2011@gmail.com
    • View Profile
    • Email
Re: Browse won't refresh from file upload, if on child form...
« Reply #3 on: July 20, 2019, 05:15:01 PM »
Here you go Niels.

Small changes in the TestForm procedure.

Just had to look for the _event_=accepted.

Browse refreshes now.  I did change the table driver to topspeed to make it easier to inspect the contents. 

See what you think.

Don
"Eliminate the impossible, whatever remains, however unlikely, must be the truth."

NetTalk 12.55
Clarion 11

Niels Larsen

  • Sr. Member
  • ****
  • Posts: 420
    • View Profile
    • Email
Re: Browse won't refresh from file upload, if on child form...
« Reply #4 on: July 20, 2019, 09:03:04 PM »
Hi Don

Thanks!
But try to add a Delete Button to the browse (and delete a record). Then things breaks again.
Do you think this is a bug or has it always been like this? As I recall, I have done this many times before - without problems.

Regards Niels

DonRidley

  • Don Ridley
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 729
  • donaldridley2011@gmail.com
    • View Profile
    • Email
Re: Browse won't refresh from file upload, if on child form...
« Reply #5 on: July 21, 2019, 10:05:55 AM »
No bug.

I have it working.

I'll have the modified example uploaded soon.


Update example app attached.

Added delete button and a change button. Changed the browse to display the uploaded image in the browse row.

The thing with the delete button is that you need to have a form for that table to perform the updates, deletes, etc.  The form does the heavy lifting as far as actually deleting or updating the table record.

Also changed:

TES:Name = LOC:FileUpload

to

TES:Name = 'uploads/' & st.FileNameOnly(LOC:FileUpload)

Since you're performing the file upload on a form that is not the table's update form you're not directly affecting the table's field that stores the path to the uploaded image.  Therefore the option to remove the webfolder path in the upload field will not work as expected.

You can see in the code that I'm re-generating the form after an upload or gainfocus event.

See what you think.

Don
« Last Edit: July 21, 2019, 10:54:27 AM by DonRidley »
"Eliminate the impossible, whatever remains, however unlikely, must be the truth."

NetTalk 12.55
Clarion 11

Niels Larsen

  • Sr. Member
  • ****
  • Posts: 420
    • View Profile
    • Email
Re: Browse won't refresh from file upload, if on child form...
« Reply #6 on: July 21, 2019, 11:38:32 PM »
Hi Don

Thanks!
Works great. Only one small thing. My upload control is also refreshed. But I can live with that for now.
Thanks again for taking the time to help.

Regards Niels

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11204
    • View Profile
Re: Browse won't refresh from file upload, if on child form...
« Reply #7 on: July 21, 2019, 11:52:09 PM »
Hi Niels, Don;

Generally speaking it was a good response, and Don got to the heart of how to make it refresh.
But of course it should not need embed code to do this, so I dug a little deeper..
(Actually a lot deeper, the code is a bit complicated).

And it turns out it is indeed a bug - and strictly related to the Upload File field type. Other field types would update the browse fine, but the Upload File did not.
I have fixed the bug for the 11.17 build. So use the work-around for now, but please remove it when you have 11.17

cheers
Bruce


Niels Larsen

  • Sr. Member
  • ****
  • Posts: 420
    • View Profile
    • Email
Re: Browse won't refresh from file upload, if on child form...
« Reply #8 on: July 22, 2019, 12:49:21 AM »
Hi Bruce

I'm glad my brain is still intact ;-)
Thanks for following up.

Regards Niels