PDA

View Full Version : selectedIndex from a dialoglist using Ext.nd.Form


dominodeviant
08-14-2007, 08:40 AM
Hi,

I am trying to make use of Ext.nd.Form mostly because I really really like and appreciate the actionbar that is generated from the forms actions/subactions.

What I now notice is that this also highly affects the fields and common JS functionality around them.

For istance say that I have a Dialog list in the form that is named 'myDiag'.
If I then call the below JS it most certain won't alert the selectedindex (as it used to):

var frm = window.document.forms[0];
var ind;

ind = frm.myDiag.selectedIndex;
alert(ind);

Is there a way to possibly get and use

ind=frm.myDiag.selectedIndex;
var minprocess = frm.myDiag.options[ind].text;

with the fields that Ext.nd.Form generates?
If the answer is yes,then how?
If the answer is no,can I disabled the field generation of Ext.nd.Form and "only" make use of the generated action bar ?

dominodeviant
08-14-2007, 08:54 AM
functions as frm.myDiag.focus(); also doesn't work

jratcliff
08-14-2007, 09:44 AM
What's happening is that the select fields are being converted to Ext.form.ComboBox elements. So, to work with an Ext ComboBox, refer to this:

http://extjs.com/deploy/ext/docs/output/Ext.form.ComboBox.html

If you want the Ext.nd.Form class to NOT convert your fields you can set the 'bConvertFields' property to false.


Ext.onReady(function() {
var frm = new Ext.nd.Form({bConvertFields : false});
frm.render();
});


Jack

RWaters
08-14-2007, 10:20 AM
Yeah this is an unfortunate downfall of binding existing javascript code to the Ext buttons. I would definitely recomend checking out the ComboBox docs that Jack posted, as well as the docs for the other Ext fields. I think you'll find that they're actually easier to work with than normal form elements. The ComboBox for example, you don't actually have to use selectedIndex, they provide getValue and getRawValue to make it easy to get the displayed value or the actual value.

dominodeviant
08-15-2007, 02:02 AM
Thanks Jack and Rich! Appreciated the assistance. I will start with 'bConvertFields : false' and then continue with reading documentations for all the ext fields untill I can repeat the text backwards.

RWaters
08-15-2007, 10:59 AM
Thanks Jack and Rich! Appreciated the assistance. I will start with 'bConvertFields : false' and then continue with reading documentations for all the ext fields untill I can repeat the text backwards.

Heh, I probably couldn't even repeat most of it forwards... I generally just skim through the docs then keep a tab open to it at all times...