Closed emteknetnz closed 4 months ago
If I save the page without expanding the block, none of the validation seems to happen. e.g. with your test blocks from the description, I add the block and immediately save the page - it should trigger validation errors for the missing required fields but it doesn't.
That would be hard to solve.
In the case of inline blocks, currently if they haven't been opened and the page is saved, then then because the child FormBuilder form hasn't been rendered then the element data will not be sent as part of the page form submission. However if the inline-element is opened then page save will submit element data with the rest of the page, and closing the element then saving the page will also send the element data. So to solve this we'd need to render the FormBuilder forms for ALL unopened elements on page save
In the case of non-inline blocks, I really don't know what can be done since their forms are never rendered on the page and and thus their data is never sent.
The fact this doesn't work doesn't actually matter given the AC is Saving/publishing a page will trigger validation on its child block if they are in a a dirty state.
- the elements in question aren't dirty, they're just created in an invalid state.
We could split this off as a seperate card, though I honestly don't know how or even if we should attempt a fix here
We could split this off as a seperate card, though I honestly don't know how or even if we should attempt a fix here
I think that's worth looking into. There's a tradeoff to be made between:
I'll open a separate card about this for discussion.
Edit: https://github.com/silverstripe/silverstripe-elemental/issues/1183
Reran CI after merging frameworktest. Confirmed they are running with the correct commit:
silverstripe/frameworktest 1.x-dev d12463a
https://github.com/silverstripe/silverstripe-frameworktest/commit/d12463ae60997ed7f9235b8ea222daba4c4e6413
behat failing
I've added an extra code change that's from a different PR that's blocked on this one which is required to get the inline-block-validation.feature behat tests to pass
Rerunning failed behat tests now that the framework PR is merged, but regardless of whether that goes green I need at least a response to my above comment.
Still need to respond to https://github.com/silverstripe/silverstripe-elemental/pull/1178#pullrequestreview-2041868677
Split of as separate card that can be refined
Issue https://github.com/silverstripe/silverstripe-elemental/issues/1155
Need to merge https://github.com/silverstripe/silverstripe-framework/pull/11213 first to get the has_one RequiredFields validation working correctly and https://github.com/silverstripe/silverstripe-frameworktest/pull/172 to get behat to pass.
There is a mutli-pr CI run linked on the issue
Note that this PR does not touch inline-saving
Scenarios:
Non-inline editable block:
Inline-editable block page save
I used the following blocks to tests these scenarios