Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Selection in custom xtype not saving

Avatar

Level 1

Hey y'all,

I have a custom xtype that I'm making that incorporates a selection of a document type as one of the fields. See code below. The problem is that this field's selection is not getting saved anywhere. I've debugged the js for my custom xtype and the "value" of typeField is never anything other than undefined or "", even when I make a selection. Any idea what could be going on here? Is selection somehow incompatible with custom xtypes or is there something else I need to do or is wrong. Appreciate any help in advance! Thank you!

 

//code this.typeField = new CQ.form.Selection({ type:"select", name: "./testTypeField", fieldDescription: "Choose Attachment Type", options: [ { value: "doc", text: "DOC" }, { value: "pdf", text: "PDF" }, { value: "xls", text: "XLS" }, { value: "zip", text: "ZIP" } ], listeners: { change: { scope:this, fn:this.updateHidden } } }); //more code
1 Accepted Solution

Avatar

Correct answer by
Level 7

Hi there,
It looks like (when comparing to other standard widgets that use the CQ.form.Selection) that you have used "changed" instead of "selectionchanged" for the listener. If that was the case that you needed that it would explain why the listener event was not fired. Then no new value would be saved and since you did not specify a default value (like: value: "doc", ) no value would be there if no selection was made either. Maybe you can try this and hopefully it will help.


/Johan

View solution in original post

1 Reply

Avatar

Correct answer by
Level 7

Hi there,
It looks like (when comparing to other standard widgets that use the CQ.form.Selection) that you have used "changed" instead of "selectionchanged" for the listener. If that was the case that you needed that it would explain why the listener event was not fired. Then no new value would be saved and since you did not specify a default value (like: value: "doc", ) no value would be there if no selection was made either. Maybe you can try this and hopefully it will help.


/Johan