PDA

View Full Version : Problem with field validation Quicktips after destroying element



jstrx
16 May 2010, 11:12 PM
Hi all; long time reader first time writer ...

I have an Ext window which consists of a couple of forms. The first form has a dropdown combo, and depending on which value the user selects, the second form gets populated/repopulated.

The layout is as follows



Window
|
|--FormPanel1 --[Combobox1]
|
|--FormPanel2
|
|---Panel(ColumnLayout1)
|
|---FormPanel3--[ ]
|
|---FormPanel4--[ ]



Based on what the users selects in Combobox1, form items are dynamically removed and added into ColumnLayout1 and 2.

I am populating ColumnLayout1 with a numberfield that has allowBlank: false so if the field is blank, it gets underlined in red and i have the Quicktip exclamation mark arrow on the side. If this textfield has a valid number in it, and i choose a different option in combobox1, all my textfields get destroyed and re-rendered with new data as defined in my Combobox listener.


However if the textfield in FormPanel3 or 4 is blank, and i try to select a new option in Combobox1, the items are destroyed but not recreated because the Quicktip still exists and is trying to align itself to an item that no longer exists. I get an 'Element.alignToXY with an element that doesn't exist error'. If i disable QuickTips, i do not have this error.

I've tried using the unregister method, but this doesn't seem to be working.

Code is as follows:




this.mainForm.getPorts.getForm().submit({
var this = parent;
success: function(form, action) {

parent.mainForm.sapPanel.columnContainerTop.left.removeAll();
parent.mainForm.sapPanel.columnContainerTop.right.removeAll();
.
.
.
}



I use the following code to try to remove the QuickTip, but it doesn't appear to be working (does unregister only work for QuickTips you've manually added yourself?). I also tried changing the value to something valid on blur in order to get rid of the quicktip, but still no luck.



scope: this,
listeners:{
blur: {
fn: function() {
if (this.getValue() == "")
{
this.setValue(0);
this.clearInvalid();
Ext.QuickTips.unregister(this.getEl());
}
else
{
//Do nothing
}


I would think that when i call removeAll() on the parent form, the validation quicktips would be destroyed as well? Or am i doing something horribly wrong?