PDA

View Full Version : [SOLVED] Clickable Icon or Button after textfield



jasondeegan
16 Sep 2009, 6:14 PM
Having done some research I saw some stuff regarding a button INSTEAD of a field, and some stuff that related to EXT 1 about this topic, but nothing that was current.

Can anyone give me a lead on how to add a clickable icon or button AFTER (meaning in addition to) a textfield in a form?

Screenshot attached.


[SOLVED, thanks to Animal for pointing me in the right direction]



var newField = new Ext.form.TriggerField({
fieldLabel: fs + ' ' + newNum, value: val, allowBlank: false, vtype: 'customPhone', validateOnBlur: true, id: fs + '-' + newNum,
triggerClass: 'x-form-clear-trigger', // I modified this class to point to my own custom PNG file.
listeners: {
'focus': function(){
var regexp = new RegExp( /^\[.+\]$/ );
if( regexp.test( this.getValue() ) ){
this.setValue( '' )
}
},
'blur': function(){
if( this.getValue() == '' ){
this.setValue( '[ Add a ' + fs + ' ]' );
}
},
'valid': function(){
var allValid = false;
for( var i = 0 ; i < Ext.getCmp( fs ).get( Ext.getCmp( 'fsf' ).findById( fs ).items.items.length ) ; i++ ){
if( Ext.getCmp( fs ).get( Ext.getCmp( 'fsf' ).findById( fs ) ).items.items[i].isValid() ){
addBlankField( fs );
}
}
}
},
onTriggerClick: function( ){
Ext.getCmp( 'fsf' ).findById( this.id ).disable();
}
});



Thanks,

Jason

tubamanu
16 Sep 2009, 11:18 PM
u can use a column layout, add an Ext Textfield and then an Ext Button.....that should work.

Animal
16 Sep 2009, 11:19 PM
This is what TriggerField is for.