Web Connection
Double Clicking on Button -- For Saving Info and poor speed connection to Internet
Gravatar is a globally recognized avatar based on your email address. Double Clicking on Button -- For Saving Info and poor speed connection to Internet
  Roy Miller
  All
  Jun 24, 2019 @ 06:38pm

Listmates, I have had a report where after the user hits the 'SAVE' button, double entries of the same data is recorded

I've tested extensively on Desk Top with good internet connection unable to reproduce.

However, I was attempting same on a tablet, where the connection to the internet was very slow. I was able to reproduce the issue reported. However, I again tried to repeat the same issue, with in seconds of first test, Made sure I pulled my finger away from the tablet and viola no double entry.

Does this sound like user get's impatient, hits the save button a couple of times, then the computer catches up to the lag and process both clicks? BTW, this is a really new development for this website , been around a while.

Thanks in advance

Gravatar is a globally recognized avatar based on your email address. re: Double Clicking on Button -- For Saving Info and poor speed connection to Internet
  Rick Strahl
  Roy Miller
  Jun 25, 2019 @ 10:43am

Hi Roy,

For any save operation in an application you should make sure that the data hasn't already been captured. Usually a double up operation won't be simultaneous, so that's probably less of a worry so you can check if the data has already been saved before writing the data again. In some cases multiple saves won't matter, but where it does, checking is a must.

IOW, it doesn't matter whether this is accidental or incidental or deliberate - your application is responsible for making sure the data doesn't get doubled up, not the UI...

It's more work, but it's a necessary part of Web applications.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: Double Clicking on Button -- For Saving Info and poor speed connection to Internet
  Roy Miller
  Rick Strahl
  Jun 25, 2019 @ 12:32pm

Thanks Rick ... More investigation reveals that Chrome browser may be at issue here.

Couple clarifying remarks, the only time double entries happen is when a NEW record is being saved. Existing records not an issue.

I tested same scenario on Edge, Foxfire and Safari with no duplicates entries. I have had other issues where I was using google ads on the pages, Boy oh Boy, did that create a nightmare. The web site became unusable because of it. Removed the Ads ... viola problem gone.

Is anybody else seeing similar issues?

Gravatar is a globally recognized avatar based on your email address. re: Double Clicking on Button -- For Saving Info and poor speed connection to Internet
  Rick Strahl
  Roy Miller
  Jun 25, 2019 @ 02:31pm

Couple clarifying remarks, the only time double entries happen is when a NEW record is being saved. Existing records not an issue.

Of course, but for new items added you can still check to see whether that record was already entered with the same data.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: Double Clicking on Button -- For Saving Info and poor speed connection to Internet
  Roy Miller
  Rick Strahl
  Jun 25, 2019 @ 02:55pm

Thanks Rick ... I'll start to work on that.

Gravatar is a globally recognized avatar based on your email address. re: Double Clicking on Button -- For Saving Info and poor speed connection to Internet
  Roy Miller
  Roy Miller
  Jun 29, 2019 @ 01:35pm

Thought I would share this code, as it seems to have fixed the issue with Chrome creating duplicate entries. After any record is added to any data base, this code is run looking to see if the record is a dupe. I tried to do this prior to the actual save, but that proved a little difficult. So, I opted to wait until the record was saved, then execute this code.

FUNCTION CheckForDupeRecord(p_cFile, p_cKeyField)
* Thank your Google for this code Ugh
* 6/26/19 Google Chrome, on some systems, is adding 2 records for each one that is 'ADDED' to the 
* system.  Therefore, going to have to make sure this information here is not a duplicate, if so then
* delete the duplicate record. Note:  This check excludes 

LOCAL l_nSelect,;
	  l_cOrder,;
	  l_aFields[1],;
	  l_nFields,;
	  l_cThisField,;
	  l_aNewEntry[1],;
	  l_nTotalDupes,;
	  l_lReturn
	  

l_nSelect = SELECT()
l_nTotalDupes = 0

SELECT (p_cFile)
l_cOrder = SET("Order")  && dont expect an order, but, safety reasons
SET ORDER TO 

l_nFields = AFIELDS(l_aFields,p_cFile)

DIMENSION l_aNewEntry[l_nFields,3 ]  && Col 1 = field name, Col 2 1st Record, Col 3 2nd record
FOR l_ni = 1 TO l_nFields
	l_aNewEntry [ l_ni, 1] = l_aFields[l_ni, 1] && The name of the field
endfor

SELECT (p_cFile)
GO bott
FOR l_ni = 1 TO l_nFields
	l_cThisField = l_aNewEntry[l_ni,1]
	l_aNewEntry[l_ni, 2] = &p_cFile->&l_cThisField
ENDFOR

* -- get the record just above it
SELECT (p_cFile)
SKIP -1 
FOR l_ni = 1 TO l_nFields
	l_cThisField = l_aNewEntry[l_ni,1]
	l_aNewEntry[l_ni, 3] = &p_cFile->&l_cThisField
ENDFOR

* -- Now Compare the two...
FOR l_ni = 1 TO l_nFields
	IF UPPER(l_aNewEntry[ l_ni, 1]) # UPPER(p_cKeyField)
		IF 	l_aNewEntry[ l_ni, 2] = l_aNewEntry[ l_ni, 3]
			l_nTotalDupes = l_nTotalDupes + 1
		ENDIF
	ENDIF
ENDFOR


IF l_nTotalDupes = (l_nFields -1) && Don't count the primary key as it is not compared
	SELECT (p_cFile)
	GO bott
	DELETE
ENDIF

SELECT (p_cFile)
SET ORDER TO &l_cOrder

SELECT ( l_nSelect)

RETURN 
ENDFUNC 

``

© 1996-2019