/    Sign up×
Community /Pin to ProfileBookmark

Truely only click ONCE!

Is there a way to assure that duplicated entrys are not accepted?

I have tried to put ‘onClick=”this.disabled”‘ on the submission button.
This works fine as long as the user stays on the page.

I do not have access to any PHP/MySQL solutions.

I was thinking of using a cookie, but don’t know if this is a viable solution.
If I did, what information other than some required field information should be saved? (I know there is some limitation on the amount of information that can be saved).

I don’t mind different entries from the same person, I just don’t want them using ‘backup’ and pressing the ‘submit’ button repetitively when the submission has not changed or changed by some minimal character count.

Any thoughts are welcome. I wll provide a coded solution based upon the answer to this ‘design phase’ question. If someone know of a solution to this problem already developed, I would welcome a link also.

Thanks.

to post a comment
JavaScript

6 Comments(s)

Copy linkTweet thisAlerts:
@toicontienJun 29.2007 — Is this form using the POST or GET method?

If you are using the GET method, you could create a JavaScript that generates an object containing all the data in the query string, and then you could use that to compare the form contents. Otherwise, you're stuck with Cookies. I read somewhere that Internet Explorer only allows you to create 4KB of cookie data per domain, whereas all other browsers allow 4KB per cookie.
Copy linkTweet thisAlerts:
@JMRKERauthorJun 29.2007 — @toicontien,

Thanks for the heads up. I believe I'm stuck with a 'formmail.cgi' and it uses a POST method as far as I'm aware. I'll certainly try using a GET to see what happens.

I did not know about a 4K total limit in IE. Currently my thoughts are if a user is stuck with that browser ... oh well, if I can't say anything nice then I'll say nothing at all.

What would you think of a compression algorithm or a checksum number to save in the cookie? Then if it compresses a field to the same value on a subsequent submit I would know the data had not changed. I don't know if this would work and since I'm still in the design phase, I still might be able to limit the amount of the submission sent. ?

Thanks for the thoughts. ?
Copy linkTweet thisAlerts:
@toicontienJun 29.2007 — Even using cookies has drawbacks. You can still submit duplicate entries if you use more than one browser, or delete cookies. If preventing duplicate entries is critical to what you're doing, no client side solution will work. But if you want people to use it and have an easy way to prevent them from duplicating entries, you could have the form submit to a new window. Just give the FORM a target="_blank" attribute. Then you could create an onsubmit function for the form that saves the form data in a JavaScript object. Subsequent submissions would parse this object to make sure no data is repeated. But once you leave the page, that data is erased.

How critical is preventing duplicate entries? Is it more for convenience or will something break if duplicates are submitted?
Copy linkTweet thisAlerts:
@JMRKERauthorJun 29.2007 — Strickly convenience. Not critical at all.

I'm just tired of removing entries from people who can not read directions to click on the submit button ONLY ONCE.

My assumption is that those who submit data are working from one computer.

May not be a valid assumption, but if they submit a duplicated entry on a different computer, it will just take up more space. What I'm trying to reduce or eliminate are those entries from users who think the button says 'fire' like they are shooting down some alien object. ?

For design purposes, is this the sequence you foresee:

1. Create site with entry fields.

2. When 'submit' is pressed, send to a new target FORM (_blank)

3. If contents of target FORM match contents of last cookie, reject submission.

4. Otherwise accept data, save as cookie and repeat from #2 as needed after closing targeted FORM window.

Again, toicontien, thanks for you considerations. ?
Copy linkTweet thisAlerts:
@slaughtersJun 29.2007 — ....I don't mind different entries from the same person, I just don't want them using 'backup' and pressing the 'submit' button repetitively...[/QUOTE]On the form page add some no-cache meta tags

Additionaly you may look into navigating from the form page by using location.history which would prevent the form page from being placed in the browsers history list, so a "back" button could not get to it.
Copy linkTweet thisAlerts:
@toicontienJun 29.2007 — You could also add this snippet of code below the FORM:
<script type="text/javascript">
<!--
is_submitting = false;
document.getElementById('myform').onsubmit = function() {
if (!is_submitting) {
is_submitting = true;
return true;
}
return false;
};
// -->
</script>
×

Success!

Help @JMRKER spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.29,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...