PDA

View Full Version : Controller listener for form text input fields?



gardner
2 May 2012, 5:57 AM
I am having problems getting the listener functions in my controller to respond to events in my input fields. I am wondering if there is something different required for form input fields because of the validation handling. I get the events for buttons, etc, but not for text inputs. Here is a fragment:

this.control( {
'input[type=text]' : {
specialkey: function() {console.log('special key pressed')},
blur: function() { console.log('blur event caught') }
},

What am I doing wrong here?

Tim Toady
2 May 2012, 6:21 AM
control uses component queries. You want to query for 'textfield'. Also, note this will be application wide. If you only want it for a specific view and your view's alias is widget.example you would query for 'example textfield'. If you want it to also apply to other field types you can query for 'field' instead of 'textfield'. I used textfield because that is what your example implied.

--edit--
Also, see Scott's post below

scottmartin
2 May 2012, 6:27 AM
Please note that you may also have to pass the shallow flag when you are specific to textfield
"textfield(true)", as all fields inherit from textfield.

Regards,
Scott.

Tim Toady
2 May 2012, 6:35 AM
@scott: Thanks for catching that. I hadn't considered it.

MVRBOSS
2 May 2012, 6:39 AM
I can't set background color for itemselector.If i giving style: 'background-color:green;', means only setting colors like in picture ..


34782

i need to set inside of like that ...


34783

my itemselctor is

multiselects: [{ width: 200,
height: 100,
frame: true,
id:'yes',
store: consultantStore,
style: 'background-color:green;',
displayField: 'label',
valueField: 'value'
},{
width: 200,
height: 100,
id:'otSelectedConsultants',
frame: true,
style: 'background-color:yellow; display:block;',
store: Selected,
displayField: 'label',
valueField: 'value',

}],


Please Help me

Tim Toady
2 May 2012, 6:47 AM
@MVRBOSS: Please don't hijack threads. You are more likely to get an answer if you open your own.