Skip to content
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

Superforms with GridStack #456

Open
gosongying opened this issue Jul 28, 2024 · 5 comments
Open

Superforms with GridStack #456

gosongying opened this issue Jul 28, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@gosongying
Copy link

Description
When forcing client-side validation when the input loses focus, setting 'onblur' for validationMethod does not seem work, while 'oninput' does work. The input element comes from shadcn-svelte Form component. It acts exactly the same as the default method.

If applicable, a MRE
superForm(serverForm, { dataType: 'json', validators: schemasafeClient(schema), id: id, validationMethod: 'auto' });
this is the code I use to construct the form on client side.

@gosongying gosongying added the bug Something isn't working label Jul 28, 2024
@ciscoheat
Copy link
Owner

I'd need a MRE on SvelteLab to investigate further, without shadcn-svelte preferably, as components can easily complicate things.

@ciscoheat ciscoheat added the question Further information is requested label Jul 29, 2024
@gosongying
Copy link
Author

Hi, sorry for the late reply, i think i have figured out the issue, it is because i am using superform along with GridStack, seems they are not compatible? Do you have any suggestion?

@ciscoheat
Copy link
Owner

I have never used GridStack, sorry. We can change this thread to be about how to integrate it.

@ciscoheat ciscoheat added enhancement New feature or request and removed bug Something isn't working question Further information is requested labels Aug 6, 2024
@ciscoheat ciscoheat changed the title Client-side validation is not triggered when validationMethod is set to 'onblur' Superforms with GridStack Aug 6, 2024
@gosongying
Copy link
Author

The input element indeed loses focus when I click outside of it, as confirmed by checking document.activeElement. However, the client-side validation isn't being triggered. I suspect that Gridstack might be interfering with the element being properly detected, as the validation works correctly when Gridstack isn't used.

@gosongying
Copy link
Author

Could you explain the underlying logic or method you use to detect if an input element is focused?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants