You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It looks like Entwine initiated React form fields read their attributes from a different place to that of the React form builder's fields.
For example, to get the tagfield form to correctly populate its saved values, the value attribute must be populated from the getSchemaData() method. For the same field, it must be populated in the getSchemaState() method to work in React forms. In the React case, it puts the value into the Redux store and populates it from there via redux-form.
The issue here is that having the value defined in both places means that it doesn't populate in the React context. The Entwine initiated field doesn't have the redux store available for the form to pull the data out of.
Another example of this is the name attribute. Because the select fields (related: #52) add hidden input fields for each tag selected, the name attribute needs to be an HTML array. To make this work in Entwine context, the name attribute must be added in getSchemaData(), but for React it must be in getAttributes(). If I have the name in getSchemaData() then the React form doesn't work, throwing console errors and some kind of infinite re-rendering loop error.
I can get this field to work in each context just fine by moving the placement of these two pieces of schema data around in the PHP class definition, but I can't get it to work with both at the same time.
The text was updated successfully, but these errors were encountered:
I think this is quite a critical bug moving forward. Fields like TagField only being usable in either entwine OR react form builder context is pretty inconvenient. Triaging as a high
It's quite possible that I've put the schema data/attributes into the wrong methods, to be fair. Either way I think that if it's difficult for me (as a core committer) then there's something to be improved here, even if it's documentation
Version: SS 4.3.x-dev
Background
I'm trying to make the silverstripe-tagfield module work correctly in a React form context.
Problem
It looks like Entwine initiated React form fields read their attributes from a different place to that of the React form builder's fields.
For example, to get the tagfield form to correctly populate its saved values, the
value
attribute must be populated from thegetSchemaData()
method. For the same field, it must be populated in thegetSchemaState()
method to work in React forms. In the React case, it puts the value into the Redux store and populates it from there via redux-form.The issue here is that having the value defined in both places means that it doesn't populate in the React context. The Entwine initiated field doesn't have the redux store available for the form to pull the data out of.
Another example of this is the
name
attribute. Because the select fields (related: #52) add hidden input fields for each tag selected, the name attribute needs to be an HTML array. To make this work in Entwine context, thename
attribute must be added ingetSchemaData()
, but for React it must be ingetAttributes()
. If I have thename
ingetSchemaData()
then the React form doesn't work, throwing console errors and some kind of infinite re-rendering loop error.I can get this field to work in each context just fine by moving the placement of these two pieces of schema data around in the PHP class definition, but I can't get it to work with both at the same time.
The text was updated successfully, but these errors were encountered: