Selection in custom xtype not saving | Community
Skip to main content
October 16, 2015
Solved

Selection in custom xtype not saving

  • October 16, 2015
  • 1 reply
  • 606 views

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
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 Ojjis

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

1 reply

Ojjis
OjjisAccepted solution
Level 7
October 16, 2015

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