Expand my Community achievements bar.

Dialog/Form validation invalid after listener execution

Avatar

Level 4

I have a dialog with a field on which I created a listener (FYI, it's a multifield on which I add to force a limit, I followed the recipe found here). So once it executes the said field's «beforeadd» callback, I am no longer able to save my data: says I should review the marked fields, although everything is apparently fine.  If I cancel and close the dialog and edit again, it is still in the same state, not allowing me to save although I haven't change anything.

If I refresh the page, then I am able to save again, ... until I use my multifield and reach the limit. Here is the code for my callback:

function(list,component,index) { if(this.fieldConfig.limit!=0) { if(index >= this.fieldConfig.limit) { CQ.Ext.Msg.show( {title: 'Limit reached',  msg: 'You are only allowed to add '+this.fieldConfig.limit+' items to this module',buttons: CQ.Ext.Msg.OK,icon:CQ.Ext.MessageBox.ERROR} ); return false; } } }

I'm guessing that the return false, upon reaching the multifield limit, sets the form validation as invalid.  How can I avoid this?

thank you for your help.

0 Replies