Deactivate button after submission

Hello,
In my members area I have a button that links to a form that allows members to register for an event (not a wix event; it captures data for a database). I’d like to disable this button once the user submits the form once. I’d also like to do the same thing for a file upload button so that once the member uploads the file, the button is disabled or disappears. Thanks in advance.

code an onClick event for the button and use the hide function to hide the button

https://www.wix.com/corvid/reference/$w.HiddenMixin.html#hide

Thanks. I’m having trouble though as the form opens a new lightbox and the button is on the members page.

How do I reference the button from the members page in the code for the lightbox with the form?

@dwyanekrzanowski
you don’t

code an onClick event for the button and use the hide function to hide the button on your member page

then also on your member page, when the page loads code a query to scan the database to see if the user has already submitted a form, if already submitted use the hide function to hide the button on your member page

@mikemoynihan99 I was just thinking that I’d be better off having the system check to see if the user filled out the form or uploaded the document as opposed to hiding on click, thanks.

I’m not well versed in coding. I’m just a designer (all aesthetics, no function) and my coding knowledge is limited to say the least. I’ll see what I can find but I might be back for some help on this.

Thanks again.

@dwyanekrzanowski
the reason you would hide the submit button onClick is to prevent them submitting multiple forms in one single session

I’d like to hide the button only if a user enters a certain text, is this possible?

Please what’s the code for a query like this

https://www.wix.com/velo/reference/wix-data/query

An OnClick event as others have suggested is technically incorrect as it won’t guarantee that the form gets submitted. Instead, you should add the event to the form submission:

  1. Turn on Developer Mode.

  2. Select your Submit button to see what its element name is. In my case, it was button3.

  3. Select the Form itself (click in the empty space beside your form)

  4. In the code view, you’ll see the form submit code (your code will be slightly different as your form name will be different as well):
    export function getSubscribers2_wixFormSubmitted ( ) {

  5. After the { press Enter/Return to create a new line and add: $w(‘#button3’).hide(); making sure to change the ‘#button3’ to whatever your submit button name is.

  6. Publish the changes and test it out. After someone submits the form, the button will disappear and your submit message will appear. Refreshing the page will bring the button back, but that’s what you want otherwise it won’t appear for the next member. You can likely modify the code further to keep it hidden permanently for that member as long as they’re signed in.

A Screenshot of my code: