How to Add An Hyperlink Like Terms and Conditions Xtemplate?

76 Views Asked by At
{ 
   xtype : 'label',     
   cls : 'termsandconditions',              
   html : ['<div>You are agreeing to our <a href="#" onclick="window.open("http://www.google.com", "_system");"> Terms and Conditions'] 
}

This is exactly what i did. Is this is the right way to do it?

2

There are 2 best solutions below

0
On BEST ANSWER

Hi At last a working one I did like this.

{

xtype: 'component',

cls: 'termsandconditions',

tpl: [
    'You are agreeing to our ',
    '<a onclick="{termsLink}"> ',
    'Terms and Conditions',
    '</a>',
],
data: {
    termsLink: "window.open('http://www.google.com','_system');",                

}
}

0
On

There is no right way to do this, but using component and autoEl property seem like the easiest ways. I use it like this :

{
    xtype  : 'component',
    type   : 'button',
    style  : {
        fontSize : '0.8em'
    },
    autoEl : {
        tag  : 'a',
        href : '#',
        html : 'Legal Notice'
    },
    listeners: {
        click: {
            element: 'el',
            fn: function(e)
            {
                window.open('/path/to/document', '_blank');
            }
        }
    }
}