A form cannot override a parent form's field if the field contains the useWhen attribute
---------------------------------------------------------------------------------------- Key: OFBIZ-863 URL: https://issues.apache.org/jira/browse/OFBIZ-863 Project: OFBiz (The Open for Business Project) Issue Type: Bug Components: framework Affects Versions: SVN trunk Reporter: Scott Gray Priority: Minor When a form definition extends another form it is unable to override a parent field if that field contains a useWhen condition. So when the parent field's useWhen condition is true, both the child and parent field end up in the generated form. For an example of the problem see https://issues.apache.org/jira/browse/OFBIZ-753 -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
[ https://issues.apache.org/jira/browse/OFBIZ-863?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12487308 ] Adrian Crum commented on OFBIZ-863: ----------------------------------- Scott, I spent some time looking into this and it is hard to tell whether this is really a bug or the intended behavior. Here are some things I ran across... 1. Field list comment from ModelForm.java: /** This List will contain one copy of each field for each field name in the order * they were encountered in the service, entity, or form definition; field definitions * with constraints will also be in this list but may appear multiple times for the same * field name. * * When rendering the form the order in this list should be following and it should not be * necessary to use the Map. The Map is used when loading the form definition to keep the * list clean and implement the override features for field definitions. */ 2. Around line 843 of ModelForm.java it seems that fields of type hidden are skipped and not rendered. 3. "use-when" comment from widget-form.xsd: <xs:annotation><xs:documentation>Used to specify a condition that must be true to use this field; the condition should be written using the Java syntax and can operate on values in the form context; if this is used the field will only be put on the field list, and not in the field map meaning that values for this field cannot be overridden.</xs:documentation></xs:annotation> > A form cannot override a parent form's field if the field contains the useWhen attribute > ---------------------------------------------------------------------------------------- > > Key: OFBIZ-863 > URL: https://issues.apache.org/jira/browse/OFBIZ-863 > Project: OFBiz (The Open for Business Project) > Issue Type: Bug > Components: framework > Affects Versions: SVN trunk > Reporter: Scott Gray > Priority: Minor > > When a form definition extends another form it is unable to override a parent field if that field contains a useWhen condition. So when the parent field's useWhen condition is true, both the child and parent field end up in the generated form. > For an example of the problem see https://issues.apache.org/jira/browse/OFBIZ-753 -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-863?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12487327 ] Scott Gray commented on OFBIZ-863: ---------------------------------- Thanks Adrian, I had wondered the same thing when I initially came across it. Perhaps we need to find a way to log a warning or error if ModelForm comes across a field that has both conditional and unconditional declarations? But checking for that might be a pain because we don't want to have to run through the field list on every addition. Another option might be to have a map for when the form fields are being rendered then log a warning if the same field name is rendered more than once, that would help catch when 2 useWhen's evaluate to true as well. Otherwise we could just add a note to the extends attribute documentation warning against overriding conditional fields. > A form cannot override a parent form's field if the field contains the useWhen attribute > ---------------------------------------------------------------------------------------- > > Key: OFBIZ-863 > URL: https://issues.apache.org/jira/browse/OFBIZ-863 > Project: OFBiz (The Open for Business Project) > Issue Type: Bug > Components: framework > Affects Versions: SVN trunk > Reporter: Scott Gray > Priority: Minor > > When a form definition extends another form it is unable to override a parent field if that field contains a useWhen condition. So when the parent field's useWhen condition is true, both the child and parent field end up in the generated form. > For an example of the problem see https://issues.apache.org/jira/browse/OFBIZ-753 -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-863?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12487331 ] Adrian Crum commented on OFBIZ-863: ----------------------------------- I've spent the last few days developing enhancements for the screen widgets, so I wouldn't mind getting involved with this. The problem is, I don't know what the intention of the author was, so I don't know if there is anything to fix. > A form cannot override a parent form's field if the field contains the useWhen attribute > ---------------------------------------------------------------------------------------- > > Key: OFBIZ-863 > URL: https://issues.apache.org/jira/browse/OFBIZ-863 > Project: OFBiz (The Open for Business Project) > Issue Type: Bug > Components: framework > Affects Versions: SVN trunk > Reporter: Scott Gray > Priority: Minor > > When a form definition extends another form it is unable to override a parent field if that field contains a useWhen condition. So when the parent field's useWhen condition is true, both the child and parent field end up in the generated form. > For an example of the problem see https://issues.apache.org/jira/browse/OFBIZ-753 -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-863?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12518111 ] Jacopo Cappellato commented on OFBIZ-863: ----------------------------------------- Scott, Adrian, I think I have fixed this recently when I have refactored some widget related code; could you please confirm this? Thanks, Jacopo > A form cannot override a parent form's field if the field contains the useWhen attribute > ---------------------------------------------------------------------------------------- > > Key: OFBIZ-863 > URL: https://issues.apache.org/jira/browse/OFBIZ-863 > Project: OFBiz > Issue Type: Bug > Components: framework > Affects Versions: SVN trunk > Reporter: Scott Gray > Priority: Minor > > When a form definition extends another form it is unable to override a parent field if that field contains a useWhen condition. So when the parent field's useWhen condition is true, both the child and parent field end up in the generated form. > For an example of the problem see https://issues.apache.org/jira/browse/OFBIZ-753 -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-863?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12518394 ] Bilgin Ibryam commented on OFBIZ-863: ------------------------------------- Jacopo, I tested it and still cannot override the parent form's field with useWhen attribute. Here is another related issue https://issues.apache.org/jira/browse/OFBIZ-1180 Regards, Bilgin Ibryam > A form cannot override a parent form's field if the field contains the useWhen attribute > ---------------------------------------------------------------------------------------- > > Key: OFBIZ-863 > URL: https://issues.apache.org/jira/browse/OFBIZ-863 > Project: OFBiz > Issue Type: Bug > Components: framework > Affects Versions: SVN trunk > Reporter: Scott Gray > Priority: Minor > > When a form definition extends another form it is unable to override a parent field if that field contains a useWhen condition. So when the parent field's useWhen condition is true, both the child and parent field end up in the generated form. > For an example of the problem see https://issues.apache.org/jira/browse/OFBIZ-753 -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-863?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Scott Gray reassigned OFBIZ-863: -------------------------------- Assignee: Scott Gray > A form cannot override a parent form's field if the field contains the useWhen attribute > ---------------------------------------------------------------------------------------- > > Key: OFBIZ-863 > URL: https://issues.apache.org/jira/browse/OFBIZ-863 > Project: OFBiz > Issue Type: Bug > Components: framework > Affects Versions: SVN trunk > Reporter: Scott Gray > Assignee: Scott Gray > Priority: Minor > > When a form definition extends another form it is unable to override a parent field if that field contains a useWhen condition. So when the parent field's useWhen condition is true, both the child and parent field end up in the generated form. > For an example of the problem see https://issues.apache.org/jira/browse/OFBIZ-753 -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-863?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12706645#action_12706645 ] Scott Gray commented on OFBIZ-863: ---------------------------------- ModelForm currently handles use-when fields by evaluating the use-when expressions in reverse order and rendering the first one that evaluates to true. This follows the pattern of regular duplicate fields where the last one defined is that one that gets rendered. Since a field without a use-when is basically just a use-when that always evaluates to true, I believe the bug is simply that fields without a use-when aren't taken into account when evaluating which use-when field to render. That is the issue I intend on fixing today, if anyone sees a problem with that please let me know. > A form cannot override a parent form's field if the field contains the useWhen attribute > ---------------------------------------------------------------------------------------- > > Key: OFBIZ-863 > URL: https://issues.apache.org/jira/browse/OFBIZ-863 > Project: OFBiz > Issue Type: Bug > Components: framework > Affects Versions: SVN trunk > Reporter: Scott Gray > Assignee: Scott Gray > Priority: Minor > > When a form definition extends another form it is unable to override a parent field if that field contains a useWhen condition. So when the parent field's useWhen condition is true, both the child and parent field end up in the generated form. > For an example of the problem see https://issues.apache.org/jira/browse/OFBIZ-753 -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-863?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Scott Gray closed OFBIZ-863. ---------------------------- Resolution: Fixed Fix Version/s: SVN trunk Fixed (after a mere 2+ years) in r772464 > A form cannot override a parent form's field if the field contains the useWhen attribute > ---------------------------------------------------------------------------------------- > > Key: OFBIZ-863 > URL: https://issues.apache.org/jira/browse/OFBIZ-863 > Project: OFBiz > Issue Type: Bug > Components: framework > Affects Versions: SVN trunk > Reporter: Scott Gray > Assignee: Scott Gray > Priority: Minor > Fix For: SVN trunk > > > When a form definition extends another form it is unable to override a parent field if that field contains a useWhen condition. So when the parent field's useWhen condition is true, both the child and parent field end up in the generated form. > For an example of the problem see https://issues.apache.org/jira/browse/OFBIZ-753 -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
In reply to this post by Nicolas Malin (Jira)
[ https://issues.apache.org/jira/browse/OFBIZ-863?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12707540#action_12707540 ] Jacques Le Roux commented on OFBIZ-863: --------------------------------------- Backported in R9.04 at r773120. > A form cannot override a parent form's field if the field contains the useWhen attribute > ---------------------------------------------------------------------------------------- > > Key: OFBIZ-863 > URL: https://issues.apache.org/jira/browse/OFBIZ-863 > Project: OFBiz > Issue Type: Bug > Components: framework > Affects Versions: SVN trunk > Reporter: Scott Gray > Assignee: Scott Gray > Priority: Minor > Fix For: SVN trunk > > > When a form definition extends another form it is unable to override a parent field if that field contains a useWhen condition. So when the parent field's useWhen condition is true, both the child and parent field end up in the generated form. > For an example of the problem see https://issues.apache.org/jira/browse/OFBIZ-753 -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. |
Free forum by Nabble | Edit this page |