Press Button Only Once

Is there a way to set a button to only allow one click per session or something like that?
Or to disable after one click?
Or to disable it after one click on that day?

@revjrblack why you need that?

I can not see how you would be able to do this without a database storing the data with a date.

This is normally used for things like competitions, where the user would enter some piece of information about themselves like their phone number, or email, etc. so you can contact them if the win the competition, obviously the competition only allows a single entry per day.

I would have a database table called
DecemberCompetition, with a compID, compEntrant, compDate

Then on your page you would have a single input for lets say enter your email address here, which after input enables or disables a button based upon if that user already exists in your database and if the date of the entry is not the same as the current date, then activate the button for them to click.

Or he can use a cookie to store the clicks and bind the cookie value to the disabled attribute of the button :slight_smile:

Would that still work with a database @Teodor, and if a user cleared their cookies could they then make a multiple clicks in a single day.

I suppose I have been cautious of cookies for a long time because I have seen many sites where i can get around their restrictions by just clearing the cookies.

The most recent one i recall is a site that allowed the user to upload a csv file with up to 100 email addresses every day that would then test them all for bounces, formatting etc. and in about 1 minute it would spit back a clean .csv file. I must have done 3000 email addresses in a single day by just clearing the cookies between each test.

2 Likes

Got your point Paul and i agree :slight_smile: i was just adding that as an option.
It might be JR does not need some really strong security, so if that is the case no need to do that with a Database :slight_smile:

1 Like

Thank you all for helping…

Here’s the deal, and maybe it will help to describe my quest to resolve this. I have a button that initiates a questionnaire. The person clicks this button, it opens a page where they fill in necessary contact info which is used throughout the remaining pages, i.e., an ID that will become a FK for the relationship to the other tables.

What has been happening is some of the people in this company is double clicking this button and causing multiple IDs that just end up as orphans. I am trying to figure out.a way to eliminate this from being able to happen. I can’t stop the ‘double clickers,’ but maybe a modification of the button’s action will prevent this completely.

To prevent double clicking I have hidden the button while the form is processing. So soon as the user clicks on the button once the button disappears so it can’t be clicked on again.

1 Like

What would be the steps in Wappler to disable the button after it is clicked?

Select your button. Use the dynamic attributes ‘Hide’ function. Select ‘processing’ in your form action in the App Connect panel

1 Like

Cool. Couldn’t be easier. Thanks Brad!

1 Like

No problem, good luck.

Hiding the button does seem to work, but it would be ‘cleaner’ to just disable (gray out) the button. I can’t seem to be able to do this with dynamic events.

1: User clicks the button
2: Button is disabled

I can select the ‘disable’ text under a button in the ‘available actions’ panel, but testing it doesn’t produce the desired result.

Is this not possible?

Please check this: Show Disabled Button with Spinner on Form Submit

It’s a little late, but, “Thank you Teodor!”

1 Like