Skip to content

Bag (BagPart), implement custom settings for a Bag with a list of different "Content Types" contained in it #15612

Answered by MarGraz
MarGraz asked this question in Q&A
Discussion options

You must be logged in to vote

I found the problem. I made a simple but effective mistake 🐔😅

I used the incorrect name attribute value for every input field. As a result, when the form was submitted and UpdateAsync was called, the Prefix value was incorrect, causing data binding to fail.

Here's an example of the correct name value:

<input name="Company.BagPart.BagPartMinMaxSettingsDisplayDriver.ContentTypeSettings[@i].MinItems" class="form-control" type="number" value="@setting.MinItems" />

I also forgot to add an hidden input field for the ContentType property. This property is non nullable and must be included in the model, otherwise the update will fail.

Thank you

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@MarGraz
Comment options

@MarGraz
Comment options

Answer selected by MarGraz
@MarGraz
Comment options

@hishamco
Comment options

@MarGraz
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants