-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/nonprofit form error message #514
Conversation
…sable turbo in form, and improve form markup.
import { Controller } from '@hotwired/stimulus' | ||
|
||
export default class extends Controller { | ||
static values = { targetUrls: Array } | ||
|
||
disableTurboForTargetUrls(event) { | ||
if (this.targetUrlsValue.includes(event.detail.url)) { | ||
event.preventDefault(); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even if we disable turbo in the message forms with data-turbo="false"
, the RECaptcha is still failing. Adding the data-turbo-track="reload"
meta tag doesn't help either, because it wipes the form error messages.
The only viable solution I found is to disable turbo before the browser issues a new request to fetch these forms. This is great because it can work across the entire app and we don't have to add data-turbo="false"
to every link_to
that links to these forms.
|
||
# recaptcha gem doesn't work well with Turbo | ||
def turbo_disabled_urls | ||
[new_nonprofit_request_url, new_contact_message_url] | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just add the urls for which you want to disable Turbo.
Context
Users were having problems sending a message on the "add a nonprofit" when submitting the form. Basically no error messages were displayed and the field were wiped.
What changed
How to test it
References
ClickUp ticket