Beforesubmit event for Dialog participant workflow step | Community
Skip to main content
ANKUR_CHAUHAN
Level 2
October 16, 2015
Solved

Beforesubmit event for Dialog participant workflow step

  • October 16, 2015
  • 7 replies
  • 4801 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by smacdonald2008

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

7 replies

Sham_HC
Level 10
October 16, 2015

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

Level 8
October 16, 2015

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

ANKUR_CHAUHAN
Level 2
October 16, 2015

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

ANKUR_CHAUHAN
Level 2
October 16, 2015

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

smacdonald2008
smacdonald2008Accepted solution
Level 10
October 16, 2015

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

ANKUR_CHAUHAN
Level 2
October 16, 2015

This link is under maintenance.

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

 

Regards

Ankur Chauhan 

Level 2
December 2, 2015

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