AEM 6.3: Radio property value within multifield dialog is not getting saved properly

Avatar

Avatar

Mac09

Avatar

Mac09

Mac09

17-04-2020

Hi, I am working on AEM 6.3 and created a question component. Within that I have an RTE for the question and the options are within the multifield means author can have multiple options for his question. Within the multifield I have 2 properties - option text and correct value(radio to determine whether value is correct or not).

         Now the issue is suppose author created a question with 4 options and he has selected first radio option as the correct answer and saved his dialog but then he realized the correct answer is second radio so he modified the value in dialog and saved it. Issue is on the next saves(after first when question was created) both the options first and second are coming as "true" within the JCR. Even if you modified component to select any other radio as correct, the existing radio values won't be changed to false and will remain true. Has anyone seen this type of issue?

 

Attaching screenshot of the content.xml and Dialog

 

Dialog screenshotDialog screenshot

 

content.xml ->

 

 

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:rep="internal"
    jcr:primaryType="nt:unstructured"
    jcr:title="Edit"
    sling:resourceType="cq/gui/components/authoring/dialog">
    <content
        jcr:primaryType="nt:unstructured"
        sling:resourceType="granite/ui/components/foundation/container">
        <layout
            jcr:primaryType="nt:unstructured"
            sling:resourceType="granite/ui/components/foundation/layouts/tabs"
            type="nav"/>
        <items jcr:primaryType="nt:unstructured">
            <tab1
                jcr:primaryType="nt:unstructured"
                jcr:title="Questions"
                sling:resourceType="granite/ui/components/foundation/container">
                <layout
                    jcr:primaryType="nt:unstructured"
                    sling:resourceType="granite/ui/components/foundation/layouts/fixedcolumns"/>
                <items jcr:primaryType="nt:unstructured">
                    <columns
                        jcr:primaryType="nt:unstructured"
                        sling:resourceType="granite/ui/components/foundation/container">
                        <items jcr:primaryType="nt:unstructured">
                            <question
                                jcr:primaryType="nt:unstructured"
                                sling:resourceType="cq/gui/components/authoring/dialog/richtext"
                                fieldLabel="Question"
                                name="./question"
                                useFixedInlineToolbar="{Boolean}true">
                                <uiSettings jcr:primaryType="nt:unstructured">
                                    <cui jcr:primaryType="nt:unstructured">
                                        <dialogFullScreen
                                            jcr:primaryType="nt:unstructured"
                                            toolbar="[format#bold,format#italic,format#underline,subsuperscript#subscript,subsuperscript#superscript,edit#cut,edit#copy,edit#paste-default,edit#paste-plaintext,edit#paste-wordhtml,links#modifylink,links#unlink,links#modifylink,links#unlink,links#anchor,findreplace#find,findreplace#replace,undo#undo,undo#redo,justify#justifyleft,justify#justifycenter,justify#justifyright,lists#unordered,lists#ordered,lists#outdent,lists#indent,table#createoredit,image#imageProps,spellcheck#checktext,generichtml#generichtml,misctools#specialchars,misctools#sourceedit,#styles,#paraformat]">
                                            <popovers jcr:primaryType="nt:unstructured">
                                                <paraformat
                                                    jcr:primaryType="nt:unstructured"
                                                    items="paraformat:getFormats:paraformat-pulldown"
                                                    ref="paraformat"/>
                                                <styles
                                                    jcr:primaryType="nt:unstructured"
                                                    items="styles:getStyles:styles-pulldown"
                                                    ref="styles"/>
                                            </popovers>
                                        </dialogFullScreen>
                                        <tableEditOptions
                                            jcr:primaryType="nt:unstructured"
                                            toolbar="[table#insertcolumn-before,table#insertcolumn-after,table#removecolumn,-,table#insertrow-before,table#insertrow-after,table#removerow,-,table#mergecells-right,table#mergecells-down,table#mergecells,table#splitcell-horizontal,table#splitcell-vertical,-,table#selectrow,table#selectcolumn,-,table#ensureparagraph,-,table#modifytableandcell,table#removetable,-,undo#undo,undo#redo,-,table#exitTableEditing,-]"/>
                                        <inline
                                            jcr:primaryType="nt:unstructured"
                                            toolbar="[format#bold,format#italic,format#underline,#justify,#lists,links#modifylink,links#unlink,#paraformat,#styles]">
                                            <popovers jcr:primaryType="nt:unstructured">
                                                <justify
                                                    jcr:primaryType="nt:unstructured"
                                                    items="[justify#justifyleft,justify#justifycenter,justify#justifyright]"
                                                    ref="justify"/>
                                                <lists
                                                    jcr:primaryType="nt:unstructured"
                                                    items="[lists#unordered,lists#ordered,lists#outdent,lists#indent]"
                                                    ref="lists"/>
                                                <paraformat
                                                    jcr:primaryType="nt:unstructured"
                                                    items="paraformat:getFormats:paraformat-pulldown"
                                                    ref="paraformat"/>
                                                <styles
                                                    jcr:primaryType="nt:unstructured"
                                                    items="styles:getStyles:styles-pulldown"
                                                    ref="styles"/>
                                            </popovers>
                                        </inline>
                                    </cui>
                                </uiSettings>
                                <rtePlugins jcr:primaryType="nt:unstructured">
                                    <links
                                        jcr:primaryType="nt:unstructured"
                                        features="*"/>
                                    <misctools
                                        jcr:mixinTypes="[rep:AccessControllable]"
                                        jcr:primaryType="nt:unstructured"
                                        features="*"/>
                                    <edit
                                        jcr:primaryType="nt:unstructured"
                                        features="*"/>
                                    <findreplace
                                        jcr:mixinTypes="[rep:AccessControllable]"
                                        jcr:primaryType="nt:unstructured"
                                        features="*"/>
                                    <format
                                        jcr:primaryType="nt:unstructured"
                                        features="*"/>
                                    <image
                                        jcr:primaryType="nt:unstructured"
                                        features="*"/>
                                    <undo
                                        jcr:primaryType="nt:unstructured"
                                        features="*"/>
                                    <table
                                        jcr:primaryType="nt:unstructured"
                                        features="*"/>
                                    <subsuperscript
                                        jcr:primaryType="nt:unstructured"
                                        features="*"/>
                                    <spellcheck
                                        jcr:primaryType="nt:unstructured"
                                        features="*"/>
                                    <lists
                                        jcr:mixinTypes="[rep:AccessControllable]"
                                        jcr:primaryType="nt:unstructured"
                                        features="*"/>
                                    <justify
                                        jcr:primaryType="nt:unstructured"
                                        features="*"/>
                                    <keys
                                        jcr:primaryType="nt:unstructured"
                                        features="*"/>
                                    <paraformat
                                        jcr:primaryType="nt:unstructured"
                                        features="*"/>
                                    <styles
                                        jcr:primaryType="nt:unstructured"
                                        features="*">
                                        <styles jcr:primaryType="nt:unstructured">
                                            <disclaimer
                                                jcr:primaryType="nt:unstructured"
                                                cssName="disclaimer"
                                                text="Disclaimer"/>
                                        </styles>
                                    </styles>
                                </rtePlugins>
                                <htmlRules jcr:primaryType="nt:unstructured">
                                    <tableHandling
                                        jcr:primaryType="nt:unstructured"
                                        mergeTfootToTbody="{Boolean}true"
                                        mergeTheadToTbody="{Boolean}false"/>
                                </htmlRules>
                            </question>
                            <multipleresponses
                                jcr:primaryType="nt:unstructured"
                                sling:resourceType="granite/ui/components/foundation/form/checkbox"
                                fieldDescription="Please don't check this checkbox if you are creating a question for Quiz"
                                listener="touch.checkbox"
                                name="./multipleresponses"
                                text="Multiple Responses allowed"
                                uncheckedValue="false"
                                value="{Boolean}true"/>
                            <options
                                jcr:primaryType="nt:unstructured"
                                sling:resourceType="granite/ui/components/coral/foundation/form/multifield"
                                composite="{Boolean}true"
                                fieldDescription="Click the '+' to add a new Option."
                                fieldLabel="Add Option"
                                fieldName="Add Option">
                                <field
                                    jcr:primaryType="nt:unstructured"
                                    sling:resourceType="granite/ui/components/coral/foundation/container"
                                    name="./options">
                                    <items jcr:primaryType="nt:unstructured">
                                        <optiontext
                                            jcr:primaryType="nt:unstructured"
                                            sling:resourceType="granite/ui/components/foundation/form/textfield"
                                            fieldLabel="Option Text"
                                            name="./optiontext"/>
                                        <correctradio
                                            jcr:primaryType="nt:unstructured"
                                            sling:resourceType="granite/ui/components/foundation/form/radio"
                                            listener="touch.rad"
                                            name="./correct"
                                            text="Correct Option"
                                            uncheckedValue="false"
                                            value="{Boolean}true"/>
                                        <correctcheckbox
                                            jcr:primaryType="nt:unstructured"
                                            sling:resourceType="granite/ui/components/foundation/form/checkbox"
                                            listener="touch.chk"
                                            name="./correct"
                                            text="Correct Option"
                                            uncheckedValue="false"
                                            value="{Boolean}true"/>
                                    </items>
                                </field>
                            </options>
                        </items>
                    </columns>
                </items>
            </tab1>
        </items>
    </content>
</jcr:root>

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

Arun_Patidar

MVP

Total Posts

2.9K

Likes

1.0K

Correct Answer

831

Avatar

Arun_Patidar

MVP

Total Posts

2.9K

Likes

1.0K

Correct Answer

831
Arun_Patidar
MVP

19-04-2020

Please check https://github.com/Adobe-Consulting-Services/acs-aem-commons/issues/679

 

and try to use granite types instead of coral types

coral - granite/ui/components/foundation/form/radio

granite - granite/ui/components/coral/foundation/form/radiogroup

 

 

<size
 jcr:primaryType="nt:unstructured"
                                         sling:resourceType="granite/ui/components/coral/foundation/form/radiogroup"
                                            name="./size"
                                            vertical="{Boolean}true">
                                            <items jcr:primaryType="nt:unstructured">
                                                <small
                                                    jcr:primaryType="nt:unstructured"
                                                    checked="{Boolean}true"
                                                    text="Small"
                                                    value="small"/>
                                                <medium
                                                    jcr:primaryType="nt:unstructured"
                                                    text="Medium"
                                                    value="medium"/>
                                                <large
                                                    jcr:primaryType="nt:unstructured"
                                                    text="Large"
                                                    value="large"/>
                                            </items>
                                        </size>

 

 

Answers (0)