PDA

View Full Version : Huge form with different "subpanels" - Validation???



Ericbr
31 Dec 2010, 3:07 AM
Hi all,

I have a form that contains a layout - with different subpanels.

Now the user has the opportunity to turn these subpanels on and off ( Ext.Panel - disabled: true / false ).

So far so good - however in these subpanels there is some form validation taking place - now my question is how can I turn the validation on / and off according to the enabled / disabled state of the Panel?

I tried: startMonitoring() / stopMonitoring() - which does not work (maybe because it is called for a Panel instead of a FormPanel)

When I create the subpanels as FormPanel I get an error - does anybody have a good idea?

The most important thing is that everything is submitted in one Post event - so I try to avoid making serveral forms out of one...

Thanks a lot!

Best regards,
Eric

steffenk
31 Dec 2010, 3:25 AM
prevent disable. Use hide / collapse or something else.

Ericbr
31 Dec 2010, 3:35 AM
Hi Steffen,

thanks for your fast reply - I tried both hiding & collapsing the subpanels - without success...
It still tries to validate ( when I submit having one panel with some allowBlank: false fields collapsed / hidden / both together - it is not doing the post event... )

Are there any other hints?

Thanks!

Regards,
Eric

steffenk
31 Dec 2010, 3:40 AM
explore your dom if you have them inside form tags.

Ericbr
31 Dec 2010, 4:19 AM
Could you please explain in a bit more detail what you mean?
I googled a lot - but did not find any resource that helped me :(

Thanks!

steffenk
31 Dec 2010, 4:21 AM
explore your dom means: open html view (best in firebug) and search for opening/closing form tag. look if your fields are all inside this tags.

Ericbr
31 Dec 2010, 4:25 AM
Okay thanks - I doublechecked - and the input fields are all in the form tags.
I think I do not get the point here...
There must be an easy way of turning the validation off for the whole Panel (not the whole form panel, but the subpanel)

mdavis6890
31 Dec 2010, 5:05 PM
I assume that you're using fieldsets, not actually different form panels. In that case, disabling the fieldset should also disable the validation. Is that not working?

Ericbr
1 Jan 2011, 3:45 AM
Hi again,

first of all happy new year to everybody! Thanks for the replys.

@mdavis6890 - I am not using fieldsets - they are actualy part of the layout but there are many of them.

I added a picture of my current situation.

Maybe it would be helpful to select all Childitems of the Containers ( just the containers have ids "cont1" "cont2" ... )
and disable them - I googled around but did not find anything suitable...

Thanks for your help!

Best regards,
Eric

mdavis6890
1 Jan 2011, 10:09 AM
If you're trying to make it one large POST anyway, just use one formpanel with a bunch of fieldsets. Is there a reason that you're trying to avoid this?



myFieldSet = Ext.extend(Ext.form.FieldSet, {
listeners : {
collapse : function() {
this.items.each(function(item, index, length) {
item.disable();
});
},
expand : function() {
this.items.each(function(item, index, length) {
item.enable();
});
}
}
});

Ericbr
1 Jan 2011, 1:58 PM
Hi mdavis6890,

that made my day - i changed some little parts here is my solution:

container.items.each(function(item, index, length) { item.items.each(function(item, index, length) { item.disable();});});