Search code examples
extjsextjs3fieldset

ExtJS : How to checking a number of already clone Fieldset ExtJS with dynamically fieldset?


As my asking title above, somebody can help me to checking a number of count already clone for fieldset in ExtJS? This is used for validation on my form. (I used ExtJS 3.0)

This is a pieces of code configuration for Fieldset ExtJS:

nameSpace: 'person',
xtype: 'fieldset',
title: 'Person',
autoHeight: true,
collapsible: true,
maxOccurs: 5,
dynamic: true,

This is a logic algorithm for my validation (if maxOccurs configuration is set to 5) :

field = fieldset.count;
if (field < maxOccurs) then
   alert("fieldset must be already five to be added!")
end if;

Now it's solved! thank you MMT for your suggestion! thank you stackoverflow!

I use a panel in outside of this fieldset, for now I resolved my problem with this code:

var personPanel = Ext.getCmp('PersonPanel');
var personLength = personPanel.extract('person','fieldset');

if(personLength.length < 5) {
   alert("fieldset must be already five to be added!");
}

Solution

  • Now it's solved!

    I use a panel in outside of this fieldset, for now I resolved my problem with this code:

    var personPanel = Ext.getCmp('PersonPanel'); //with id "PersonPanel" on a Ext.form.Panel attribute
    var personLength = personPanel.extract('person','fieldset'); //"person" is namespace of fieldset
    
    if(personLength.length < 5) {
       alert("fieldset must be already five to be added!");
    }