The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

accguy (18) [Avatar] Offline
#1
I am playing around with / trying to adapt the example app, and having a problem getting forms to render. I have been beating my head against the wall with this for about a whole day now, and figured it was time to ask for some help.

I have plucked everything I can out of the code below to keep it as simple as possible. So, this form will not render unless I comment out the Ext.applyif().


Ext.ns("IPRequest.form");

IPRequest.form.commonIPRequestForm = Ext.extend(Ext.form.FormPanel, {
border : true,
autoScroll : true,
bodyStyle : 'background-color: #aabbcc; padding: 30px',
layout : 'form',
labelWidth : 40,
defaultType : 'textfield',
defaults : {
width : 200,
maxLength : 255,
allowBLank : false
},
//private
//constructs the form layout elements.
initComponent : function() {
Ext.applyif(this, {
tbar : this.buildTbar
});
this.items = [
{
xtype : 'textfield',
fieldLabel : 'Last',
name : 'lastName',
anchor : '-10',
allowBlank : false,
maxLength : 50
}
];

IPRequest.form.commonIPRequestForm.superclass.initComponent.call(this);

},

buildTbar : function() {
return [
{
text : 'Reset',
//iconCls : 'icon-arrow_undo',
scope : this,
handler : this.onReset
}
];
},

onReset : function() {
this.reset();
}
});

Ext.reg('commonIPRequestForm', IPRequest.form.commonIPRequestForm);

Any help or insight would be really appreciated.

Acc.
jesus.garcia (463) [Avatar] Offline
#2
Re: Form Will Not Render
try this.buildTbar()
accguy (18) [Avatar] Offline
#3
Re: Form Will Not Render
> try this.buildTbar()

Jesus,

Thank you for the response! Your book rocks, BTW.

I tried that, with the same results.

So, I took the only attribute being applied and moved it inline, as below and it still does not render. However, this time, some of the panels render (but are empty and just 3 or 5 pixel wide bars).

Ext.ns("IPRequest.form");

IPRequest.form.commonIPRequestForm = Ext.extend(Ext.form.FormPanel, {
border : true,
autoScroll : true,
bodyStyle : 'background-color: #aabbcc; padding: 30px',
layout : 'form',
labelWidth : 40,
defaultType : 'textfield',
tbar : [
{
text : 'Reset',
//iconCls : 'icon-arrow_undo',
scope : this,
handler : this.onReset
}
],
defaults : {
width : 200,
maxLength : 255,
allowBLank : false
},
//private
//constructs the form layout elements.
initComponent : function() {
//Ext.applyif(this, {
// tbar : this.buildTbar()
//});
this.items = [
{
xtype : 'textfield',
fieldLabel : 'Last',
name : 'lastName',
anchor : '-10',
allowBlank : false,
maxLength : 50
}
];

IPRequest.form.commonIPRequestForm.superclass.initComponent.call(this);

},

...
Acc.
accguy (18) [Avatar] Offline
#4
Re: Form Will Not Render
And, if I change the toolbar to a bottom toolbar (bbar), then the form section renders full height (30px), but, no fields. Also, none of the parent panel's toolbars render either. Strangeness. It seems as if when I attempt to put a toolbar, of any kine on this FormPanel, it botches things up.

Thank you again for your help!

Acc.
accguy (18) [Avatar] Offline
#5
Re: Form Will Not Render
Another update:

If I change it to an 'fbar', the form renders, with the button below the form field, however, when I put data into the field, an click the Reset button, nothing happens and the text remains in the field.

So, just for run, I commented out the fbar section of the object, and uncommented the Ext.applyif() statement, changing the name to 'fbar'. And, that does not render, anything.

Strange stuff

Thank you


Acc.
jesus.garcia (463) [Avatar] Offline
#6
Re: Form Will Not Render
Acc. Can you do me a huge favor? Please pate your code in extpaste.com or pastebin.com and post a link?

I can't read it well here on this forums.
accguy (18) [Avatar] Offline
#7
Re: Form Will Not Render
Jesus,

http://www.extpaste.com/#3160

Thanks again for helping. This is starting to drive me nutso smilie

Acc
accguy (18) [Avatar] Offline
#8
SOLVED: Re: Form Will Not Render
Ext.applyif()

should be (capital I):

Ext.applyIf()

Thanks was a painful day !

Acc.
jesus.garcia (463) [Avatar] Offline
#9
Re: SOLVED: Re: Form Will Not Render
Glad you were able to resolve it. To be honest, I have been having an extremely busy day and could not get to look at the paste in time.
accguy (18) [Avatar] Offline
#10
Re: SOLVED: Re: Form Will Not Render
I appreciate your help! Your book is great!

Here the problem is that JS silently dies when something goes wrong, like calling an undefined routine, like in this case. I wish there was an IDE that would catch stuff like that.

Acc.
jesus.garcia (463) [Avatar] Offline
#11
Re: SOLVED: Re: Form Will Not Render
What debugging tools are you using?

I use IntelliJ idea, which does a really good job at auto completion, etc. But, it's not perfect.
accguy (18) [Avatar] Offline
#12
Re: SOLVED: Re: Form Will Not Render
I have been using Komodo IDE lately. Someone suggested it for Perl, and it works really well. Komodo understands JS, but, it may be a limitation of the language that stops JS from throwing an error when you call an unknown routine. In perl and php, if you call a routine that does not exist, they bot die loudly.

Acc.