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

ENH Pass form validation result to client #1246

Conversation

emteknetnz
Copy link
Member

@emteknetnz emteknetnz commented Aug 26, 2021

Issue silverstripe/silverstripe-elemental#764

Allows the ValidationResult to be passed to the client as part of a pjax response

Wrapping the JSON in a <script type="application/json"> is something of a workaround due to the expectation that pjax returns HTML. If it's not wrapped in a <script type="application/json"> tag it will fail here https://github.com/silverstripe/silverstripe-admin/blob/1/client/src/legacy/LeftAndMain.js#L775

code/LeftAndMain.php Outdated Show resolved Hide resolved
@michalkleiner
Copy link
Contributor

That's an interesting mechanism with the header, didn't know there was something like that. Always learning :)

Looks ok to me, let's wait for the tests.

@brynwhyman
Copy link

Just came across this PR which I thought was worth noting here incase yo uhadn't seen it: silverstripe/silverstripe-elemental#921

@GuySartorelli GuySartorelli force-pushed the pulls/1/pjax-validation-result branch from fbf881e to f7403a7 Compare May 10, 2023 21:52
@GuySartorelli GuySartorelli changed the base branch from 1 to 1.13 May 10, 2023 21:52
@GuySartorelli GuySartorelli force-pushed the pulls/1/pjax-validation-result branch 2 times, most recently from dc9bc7b to ef580d8 Compare May 15, 2023 21:15
@GuySartorelli GuySartorelli force-pushed the pulls/1/pjax-validation-result branch from ef580d8 to a802828 Compare May 15, 2023 22:06
Copy link
Member Author

@emteknetnz emteknetnz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd tick "Approve" if I wasn't the original author on this PR

@michalkleiner michalkleiner merged commit c0d05af into silverstripe:1.13 May 16, 2023
9 checks passed
@michalkleiner michalkleiner deleted the pulls/1/pjax-validation-result branch May 16, 2023 11:57
@michalkleiner
Copy link
Contributor

michalkleiner commented May 16, 2023

Approved and merged, but now I wonder whether it should've targeted 2 as an enhancement? But seeing the target branch was updated last week by @GuySartorelli I'm not sure. LMK.

@GuySartorelli
Copy link
Member

GuySartorelli commented May 16, 2023

On its own, yes this is just an enhancement and belongs in 2 - but it was done specifically to work with silverstripe/silverstripe-elemental#930 in order to solve silverstripe/silverstripe-elemental#764 - so it's part of a wider work to fix a bug that's pretty egregious, and I think in this case warrants being released in CMS 4 as a patch.

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

Successfully merging this pull request may close these issues.

None yet

4 participants