Closed rjo closed 2 years ago
Update ... if I call $('#form').enableClientSideValidations();
in my stimulus controller's connect() function the problem never occurs.
What might be the reason that CSV would be intermittently enabled?
Hi,
yes, it can be. It should happen when turbo:load
or ready
events are not called, so maybe when stimulus swaps the content inside a page
having connect()
to call the event should be the way to go
It is not so different from https://github.com/DavyJonesLocker/client_side_validations/wiki/Bootstrap-Modal-Validations
For the moment I'm closing here
@rjo feel free to create a new wiki page about stimulus integration
Apologies in advance for not filing with the template. I'm blocked by policy from pasting in all my form code. If requested I'll create a test app and use that for a full report.
CSV is working great for me, but 1 out around 10 page loads $('#form')[0].ClientSideValidations.settings is undefined. I keep thinking its some kind of load order problem but I've noodled on that and can't narrow it down.
Rails 7.0.2 Ruby 3.0.3 CSV 20.0.2
I'm using import maps
importmap.rb
application.js
I'm using a stimulus controller to handle manual validation by checking
$('#form').isValid($('#form')[0].ClientSideValidations.settings.validators)
This works great the vast majority of the time but every now and then
$('#form')[0].ClientSideValidations.settings
is undefined and I have no idea why or where to look at this point.Ideas?