close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

If a user double clicks the add or insert button on an insert/update form it adds two

Thread began 1/07/2010 1:34 pm by neil.batchelor254136 | Last modified 5/18/2011 10:25 am by Jason Byrnes | 2833 views | 11 replies |

neil.batchelor254136

If a user double clicks the add or insert button on an insert/update form it adds two

If a user double clicks the add or insert button on an insert/update form it adds two records, one if often incomplete.

Some of my users are not that intelligent, how can I prevent the double record add or update and just allow one click please?

I should say that if the user clicks on the add or update form once it is perfect.
So how do I prevent the stupid double click from causing bad records or problems.

Thanks,
Neil

Sign in to reply to this post

Jimmy Wu

You can set the onclick to disable the button after it is clicked once, thus preventing the 2nd click also submitting the form. There are some examples of what you can try using javascript that can be found if you do a web search. Here's one of them:
disable-button-after-first-click/

Sign in to reply to this post

neil.batchelor254136

no double click on submit

Thanks Jimmy but none of that worked??

Instead I put this in the form action:

<form action="EATING_PLACES_Insert.php" method="post" name="WADAInsertForm" id="WADAInsertForm" onsubmit="if (formCheck(this)) { this.elements['Insert'].disabled=true; } else { return false; }">

but this doesn't work either!!???

Does anyone have any ideas please?

Plus how do I string together onsubmit events, it is ok like this:

<form action="LISTINGS_Insert.php" method="post" name="WADAInsertForm" id="WADAInsertForm" onsubmit="if (formCheck(this)) { this.elements['Insert'].disabled=true; } else { return false; }

&& (using the && to link onsubmit)

WAValidateEL(document.getElementById('WADAInsertForm').VENUE_NAME,document.getElementById('WADAInsertForm').VENUE_NAME.value,'Your Venue Name has an invalid number of characters in entry. The maximum allows is 250 characters.',1,250,'',document.getElementById('WADAInsertForm').VENUE_NAME,0,true);WAValidateEM(document.getElementById('WADAInsertForm').GENERAL_EMAIL,document.getElementById('WADAInsertForm').GENERAL_EMAIL.value,'The general email input is not valid. Please reenter using a real email address.',document.getElementById('WADAInsertForm').GENERAL_EMAIL,0,false);WAValidateEM(document.getElementById('WADAInsertForm').GM_EMAIL,document.getElementById('WADAInsertForm').GM_EMAIL.value,'The general manager email input is not valid. Please reenter using a real email address.',document.getElementById('WADAInsertForm').GM_EMAIL,0,false);WAValidateEM(document.getElementById('WADAInsertForm').DIR_SALES_EMAIL,document.getElementById('WADAInsertForm').DIR_SALES_EMAIL.value,'The Sales Director email input is not valid. Please reenter using a real email address.',document.getElementById('WADAInsertForm').DIR_SALES_EMAIL,0,false);WAValidateEM(document.getElementById('WADAInsertForm').CB_MGR_EMAIL,document.getElementById('WADAInsertForm').CB_MGR_EMAIL.value,'The C&B manager email input is not valid. Please reenter using a real email address.',document.getElementById('WADAInsertForm').CB_MGR_EMAIL,0,false);WAValidateEM(document.getElementById('WADAInsertForm').CB_CONTACT_EMAIL,document.getElementById('WADAInsertForm').CB_CONTACT_EMAIL.value,'The C&B contact email input is not valid. Please reenter using a real email address.',document.getElementById('WADAInsertForm').CB_CONTACT_EMAIL,0,false);WAValidateEL(document.getElementById('WADAInsertForm').NEAREST_LANDMARK,document.getElementById('WADAInsertForm').NEAREST_LANDMARK.value,'- Invalid number of characters in entry Nearest Landmark (maximum two thousand characters allowed)',0,2000,'',document.getElementById('WADAInsertForm').NEAREST_LANDMARK,0,false);WAValidateEL(document.getElementById('WADAInsertForm').SEARCH_PREF,document.getElementById('WADAInsertForm').SEARCH_PREF.value,'There is an invalid number of characters in entry search preference (maximum two thousand characters allowed)',0,2000,'',document.getElementById('WADAInsertForm').SEARCH_PREF,0,false);WAValidateEL(document.getElementById('WADAInsertForm').PARK_DESC,document.getElementById('WADAInsertForm').PARK_DESC.value,'There is an invalid number of characters in entry park description (maximum two thousand characters allowed)',0,2000,'',document.getElementById('WADAInsertForm').PARK_DESC,0,false);WAValidateDT(document.getElementById('WADAInsertForm').INSERT_DATE,'- You have an invalid insert date. The format has to be yyyy/mm/dd',true,/\b\d{4}\/(1[0-2]|0[1-9])\/([12]\d|3[0-1]|0[1-9])\b/,'yyyy/mm/dd','','',false,/.*/,'','','',document.getElementById('WADAInsertForm').INSERT_DATE,0,true);WAAlertErrors('The following errors were found','Correct invalid entries to continue please',true,document.getElementById('false'),false);WAValidateEL(document.getElementById('WADAInsertForm').LOCATION_DESC,document.getElementById('WADAInsertForm').LOCATION_DESC.value,'There is an invalid number of characters in entry location description (maximum two thousand characters allowed)',0,2000,'',document.getElementById('WADAInsertForm').LOCATION_DESC,0,false);WAValidateEL(document.getElementById('WADAInsertForm').GM_DESC,document.getElementById('WADAInsertForm').GM_DESC.value,'There is an invalid number of characters in entry GM Description(maximum two thousand characters allowed)',0,2000,'',document.getElementById('WADAInsertForm').GM_DESC,0,false);WAValidateNM(document.getElementById('WADAInsertForm').PARK_NMBR_SPACES,'The field with the number of parking spaces is invalid.',0,1000000000000,'','','',',.',document.getElementById('WADAInsertForm').PARK_NMBR_SPACES,0,false);WAValidateEL(document.getElementById('WADAInsertForm').CB_DESC,document.getElementById('WADAInsertForm').CB_DESC.value,'There is an invalid number of characters in entry CB description (maximum two thousand characters allowed)',0,2000,'',document.getElementById('WADAInsertForm').CB_DESC,0,false);return document.MM_returnValue">

Sign in to reply to this post

Jimmy Wu

Try setting the onclick event like this:
onClick="disabled=true;this.form.submit();return true;"

I found that information here:
t-28560.html

As well as a method to use the onsubmit for the form and setting the onsubmit function to not do anything the second time it is submitted.

Sign in to reply to this post

neil.batchelor254136

No double click

Sorry Jimmy I dont have much faith in this because:

One post says:

Working on some other problem, I found a solution to it. I added the following attribuut to the submit button:

onClick="disabled=true;this.form.submit();return true;"

and another says:

Do not use submit button, but form onsubmit event.

<form onsubmit="return verifyData(this)" ...


function verifyData(myForm)
{ /* Do your data verification here */
/* If everything is ok and you are ready to submit */
myForm.onsubmit = function()
{ alert('How about some patience, huh? ;^)');
return false;
};
return true;
}
fredmv
02-24-2004, 05:46 PM


Do not use submit button, but form onsubmit event.Completely correct; can't believe I didn't think of that.


So I am totally confused on what to use and exactly how to implement it.

Thanks,
Neil

Sign in to reply to this post

Jimmy Wu

There were two different methods proposed for accomplishing the prevention of the double click. The first one being to put the code into the submit button:
onClick="disabled=true;this.form.submit();return true;"

The second was to apply changes to the form onsubmit. The second method would change the onsubmit function so that if it is clicked on the second time it would alert a message instead of submitting the form. You can change the message to something more fitting to your form, like "Please do not double click the submit button".

These both look like valid solutions to this issue.

Sign in to reply to this post

neil.batchelor254136

restrict user double click the submit button

Jimmy and any other help,

I still haven't found a solution that works. I would really like a step by step idiots guide to restrict user double click the submit button.

Many thanks,
Neil

Sign in to reply to this post

Jimmy Wu

Can you send me a page with the code applied so I can take a look at it?

Sign in to reply to this post

Thomas Hill

Prevent user double clicking

Hi I've been looking around for a solution to preventing a user from double clicking a button on a form, and therefore submitting duplicate entries to the database.

The thread here does not show a final solution and I wondered if there was one?

I've attached my page for you to look at, since I am completely lost as to how to implement it.

Thanks

Tom

Attached Files
email_settings.zip
Sign in to reply to this post

Jason ByrnesWebAssist

hide the submit button on click.

change:

<input name="Add_New_Ticket" type="image" id="Add_New_Ticket" value="Add_New_Ticket" src="../images/add.png" alt="Add_New_Ticket" hspace="0" vspace="0" border="0"  />



to:

<input name="Add_New_Ticket" type="image" id="Add_New_Ticket" value="Add_New_Ticket" src="../images/add.png" alt="Add_New_Ticket" hspace="0" vspace="0" border="0"  onClick="this.style.visibility = 'hidden';" />
Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...