0
votes

I have group of text field in a cq dialog. i want disable without using for loop in js. Is it possible to disable findByType("textfield").disable like this code so that all the text field in that dialog will be disabled

1
AFAIK it doesn't work in a single statement, though I am not very sure. However you can use CQ.Ext.each(findByType("textfield"), function() { this.setDisabled(true); }); - rakhi4110
Thanks a lot. its working - Vijay Marudhachalam
But it should be like this CQ.Ext.each(dialog.findByType("textfield"), function() { this.setDisabled(true); }); - Vijay Marudhachalam
Yes it should be the same. Since you didnt mention on what you were using the findByType method in your question, I just left it generic. Will add an answer to this with the correct script. - rakhi4110
Thanks a lot...pls add this in answer. - Vijay Marudhachalam

1 Answers

1
votes

I don't think you can achieve it in a single statement. However, you can use the CQ.Ext.each to loop over the collection of textfield and then disable them.

Assuming you have the handle of the parent container such as dialog / panel (in this case a dialog), the code would be as follows.

CQ.Ext.each(dialog.findByType("textfield"), function() { 
    this.setDisabled(true); 
});