Changing submit button states - custom forms

Quick (hopefully) question:

Context: I have a custom form that isn’t being submitted to Webflow, I’m handling it internally. The problem is that the least ‘submit-y’ behavior I could get was to set Action = #…unfortunately, that still wipes the form entries, and clients will likely want to re-use their previous inputs.

My hack: I deleted the submit button and added a regular button (link) instead, attached javascript listeners to it, etc.

Question: Is there any way to set its property to say “Processing…”/disable the button like form submit buttons? And where would I change its appearance? Alternatively, if you know how to stop this form from clearing its inputs, that would work too. Ideally, once the response is received (after the server-side processing of the form), I can toggle the button back to accept new inputs.

I don’t know much about webflow yet but I think this can be done by JQuery easily…

When the form is submitted… Change the InnerHTML of the button to Processing…
Then once you recieve the completed trigger, change it back to Submit…
Similarly you could set the button to disabled…

$('#btn_submit').attr('disabled',true);

PS: I would suggest using JQuery since it’s easier to use and is already imported by all webflow sites…

Awesome, thanks. I wasn’t sure if a jQuery approach would have it say “Processing” or not, but I hadn’t thought of the innerHTML portion. I’ll look into this into this.

Great! Tell me if it works out for you! :thumbsup:

Works like a charm :smile: . Had no idea I could innerHTML the text.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.