Created
March 7, 2023 12:19
-
-
Save bennadel/2549e3c28b7f7a793c2e9ee5a451cc62 to your computer and use it in GitHub Desktop.
Styling Submit Buttons During Form Submission With Hotwire And Lucee CFML
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
if ( request.isPost ) { | |
// Sleeping to give us time to observe the busy-state of the submit button. | |
sleep( 2000 ); | |
location( url = "index.htm?signed=true", addToken = false ); | |
} | |
</cfscript> | |
<cfmodule template="./tags/page.cfm"> | |
<cfoutput> | |
<h2> | |
Welcome to My Site | |
</h2> | |
<form method="post" action="index.htm"> | |
<p> | |
<textarea | |
name="message" | |
placeholder="Sign my guest book :)" | |
rows="3" | |
cols="40" | |
></textarea> | |
</p> | |
<p> | |
<!--- | |
When the form is being submitted, Turbo Drive will automatically | |
disable THE ACTIVE SUBMISSION BUTTON as well as apply the "submits | |
with" text if the directive is present on the targeted submission | |
button. All other submission buttons remain active and unchanged in | |
their rendering while the form is being processed. | |
---> | |
<button | |
type="submit" | |
data-turbo-submits-with="Submitting..." | |
class="submit-button"> | |
Submit | |
</button> | |
<button | |
type="submit" | |
data-turbo-submits-with="Submitting..." | |
class="submit-button"> | |
Submit | |
</button> | |
</p> | |
</form> | |
</cfoutput> | |
</cfmodule> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.submit-button { | |
background-color: #ec005a ; | |
color: #ffffff ; | |
cursor: pointer ; | |
&[ disabled ] { | |
background-color: #212121 ; | |
cursor: wait ; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment