Expand my Community achievements bar.

SOLVED

Beforesubmit event for Dialog participant workflow step

Avatar

Level 2

Hi All,

I have a dialog in which authors are supposed to enter some mandatory fields. One of the mandatory fields is a multifield widget.
For this multifield widget I have set "allowBlank = false", but whatever and howsoever values I add to this multifield widget, the validation always fails (See attached screenshot).
[img]image1.png[/img]

As a workaround I also tried using widget event mechanism making use of "beforesubmit" event but since I am using this dialog within a workflow "Dialog participant step", this event never gets fired. Although this event does get fired when used as a standard component dialog.

How could I solve this issue (multifield widget validation). It seems like a PRODUCT BUG to me (AEM 5.6.1).
If so please provide a hotfix or an alternate solution.

- Ankur

1 Accepted Solution

Avatar

Correct answer by
Level 10

If it does not work as per the AEM docs - then please file a bug here:

http://helpx.adobe.com/marketing-cloud/experience-manager.html

View solution in original post

7 Replies

Avatar

Level 10

it should work. Make sure you set the validation at right place. Can you try with maxLength property?

Avatar

Level 8

Have you tried putting allowBlank=false on the fieldConfig element instead of the main multi-field widget. 

Avatar

Level 2

Yes, I have tried this option but it didn't work for me.

When I add "allowBlank" property on fieldconfig it works only when I expand this multifield for first level and leave this field blank. At the time of submit it displays me validation error ("Verify the value of mark field."). 

But the Problem is If I don't expand this field & submit this dialog then validation doesn't work. I want at the time of dialog submit It will validate for minimum one value in this multifield. 

- Ankur

Avatar

Level 2

I am posting my dialog.xml file.

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
    jcr:primaryType="cq:Dialog"
    xtype="dialog">
    <items
        jcr:primaryType="cq:WidgetCollection"
        xtype="panel">
        <customMultiField
            jcr:primaryType="cq:Widget"
            fieldDescription="Field for getting inputs from user"
            fieldLabel="Select Options"
            name="targetOption"
            xtype="multifield">
            <fieldConfig
                jcr:primaryType="cq:Widget"
                allowBlank="{Boolean}false"
                options="/bin/target-list.2.html"
                optionsRoot="2"
                type="select"
                xtype="selection"/>
        </customMultiField>
    </items>
</jcr:root>

I am using "dialog participant step" so my dialog looks like --

[img]dialog_1.jpg[/img]

If I click ok then no validation occur on this multifield because this field doesn't expended so fieldconfig validation never occur.

if I add "allowBlank" on dialog multifield then my xml looks like

<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
    jcr:primaryType="cq:Dialog"
    xtype="dialog">
    <items
        jcr:primaryType="cq:WidgetCollection"
        xtype="panel">
        <customMultiField
            jcr:primaryType="cq:Widget"
            allowBlank="{Boolean}false"
            fieldDescription="Field for getting inputs from user"
            fieldLabel="Select Options"
            name="targetOption"
            xtype="multifield">
            <fieldConfig
                jcr:primaryType="cq:Widget"
                allowBlank="{Boolean}false"
                options="/bin/target-list.2.html"
                optionsRoot="2"
                type="select"
                xtype="selection"/>
        </customMultiField>
    </items>
</jcr:root>

Now I add some value to this multified and try to submit, it again fails and validation error and field is marked red as shown-

[img]dialog_2.jpg[/img]

validation error is - "verify the value of marked field".

maxLength doesn't work for me.

 

-Ankur Chauhan

Avatar

Correct answer by
Level 10

If it does not work as per the AEM docs - then please file a bug here:

http://helpx.adobe.com/marketing-cloud/experience-manager.html

Avatar

Level 2

This link is under maintenance.

Thanks to both of you for giving your time and attention.

 

Regards

Ankur Chauhan 

Avatar

Level 2

Hi Maintenance team,

I got the same issue on AEM6.1. I have taken time to solve this by add listeners

beforesubmit

{code}

<destinations        jcr:primaryType="cq:Widget"        fieldLabel="Destinations"        name="./destinations"        allowBlank="{Boolean}false"        xtype="multifield"><fieldConfig            jcr:primaryType="cq:Widget"            allowBlank="{Boolean}false"            xtype="editorialdestinationwidget"/><listeners            jcr:primaryType="nt:unstructured"            loadcontent="function(field, record) { if(record.get('destinations') == undefined) { field.addItem(); field.doLayout(); } }" /></destinations>

{code}

but it still doesn't work. Hope to get your pay attention on this issue. Many thanks.

 

Regards,

Hung Vu