It’s time for fill in some forms! Since we are already able to query for some Ext.form.field.Text components, then lets put text into it.
I’ve been circling around mystic JavaScript methods of programmatically simulating key strokes by creating and dispatching KeyboardEvent. I spent a while experimenting, but I got no satisfactory result, so I decided to resort to much simpler approach.
Every input element in DOM has value property. Fortunately, value is read-write property, so by simply tampering with it you are able to change it as you see fit. Ext.form.field.Text component is based on input and one can reach to it querying underlying dom:
var input = component.el.dom.querySelector('input'); input.value = 'my value';
However, this will not suffice. We would bypass Ext JS’ validation with such approach. We definitely don’t want this. Fortunately, validation can be fired by simply focusing and bluring on input.
input.focus(); var input = component.el.dom.querySelector('input'); input.value = 'my value'; input.blur();
…that’s what actually Pathfinder Ext JS does under the hood after week 2.
I’ve also added a simple method getValue that just calls getValue() of given component.
0