View Full Version : Help with Templates and xtype label in Form

10 Oct 2010, 6:38 PM
I am hoping to put some formatted text at the top of a form. I was hoping to use a xtype:label and then use a template to put in HTML formatted text that included field data loaded in to the form.

Can anyone give me a quick example (or point me to one) of how to do this? Everything I can find on using templates includes doing something like: tpl.overwrite(p.body, data). I tried to use this in a render listener for the form...but I don't know how to reference the automatic datastore of a simple form.

I have been beating my head against the wall trying to get this to work, but it seems like just setting the tpl of the label should work...I just am not getting the syntax correct.

Thanks in advance...

11 Oct 2010, 12:32 AM
xtype:'label' creates a <label> tag. You want plain HTML, so you should be using an xtype:'box', e.g.

xtype: 'box',
anchor: '100%', // <- full width in layout:'form'
autoEl: {
tag: 'div',
html: 'Hello world!'