NetTalk Central

Author Topic: disconnected app and getting a form to update  (Read 4217 times)

jking

  • Sr. Member
  • ****
  • Posts: 419
    • View Profile
    • Email
disconnected app and getting a form to update
« on: February 13, 2019, 08:32:25 AM »
     I'm slowly making some progress with my Coin Collecting PWA app.  The issue I have today is the following:

I open the browse, select a record and open the form.  This form has three tabs.  Basic data is on tabs 1 and 2.  I have two image controls on tab 3.  On tab 3 I have a button that has JS code attached (on click) to modify the src attribute for each image control:

function setObverseImage() {      
   
   $("#obvImage").attr("src", "/uploads/"+$("#CC__Coin_Image_Name_Obv").val());

   }

function setReverseImage() {      
   
   $("#revImage").attr("src", "/uploads/"+$("#CC__Coin_Image_Name_Rev").val());
   
   }

So, I go to tab 3, click the button to run my JS code, and the images are displayed.  Next, I save or close the form and select another record from the browse, and the form opens but still on tab 3 with the old images displayed, but all other fields have the newly selected data.  I must click the button again to get the above JS code to run and show the correct images.  I don't think this is a image cache issue, I suspect this is an Ajax issue, where only parts of the form are updated.

I want to find a way to get the images updated when I select a new record, and not have to manually click the button to update the images.  Thoughts?

Thanks,

Jeff King