getSelect returns null

I know it’s something I’m doing wrong but I can’t figure out what it is.

I have dhx window that opens with an attached form inside. Everything works properly except the getSelect() method is returning null.

[code] var formWindow = new dhtmlXWindows();

	appToolbar.attachEvent('onClick', function(id){

		if(id == 2){

			var fw1 = formWindow.createWindow({
				id: 'fw1',
				left: null,
				top: null,
				width: 500,
				height: 400,
				center: true,
				caption: 'Create a new Application'
			var fwForm = fw1.attachForm();
			var fwSelect = fwForm.getSelect('appType');


fwForm.attachEvent(‘onChange’, function(name,value){



Here is my form structure which is contained in a separate file.

<?xml version="1.0" encoding="UTF-8"?>
  <item type='settings' position='absolute' labelWidth='140' inputWidth='120'/>
  <item type='label' label='Complete items to create a new Application, Form or Report framework:' labelWidth='450' labelTop='2' labelLeft='9'/>
  <item type='input' name='appName' label='Name' tooltip='Enter a user friendly name' required='true' info='false' labelTop='25' labelLeft='12' inputTop='40' inputLeft='10'/>
  <item type='input' name='appVersion' label='Version' tooltip='Current version [Format: 00.00.01].' disabled='true' value='00.00.01' labelTop='25' labelLeft='187' inputTop='40' inputLeft='185'/>
  <item type='input' name='dirName' label='Directory Name' tooltip='Enter a new directory name (no spaces or special characters).' required='true' validate='^[\\w.-]+$' labelTop='80' labelLeft='12' inputTop='95' inputLeft='10'/>
  <item type='input' name='appId' label="ID" tooltip='The ID is automatically generated.' disabled='true' value='Auto' labelTop='80' labelLeft='187' inputTop='95' inputLeft='185'/>
  <item type='select' name='appType' label='Type' tooltip='Type of object to create.' required='true' labelTop='135' labelLeft='12' inputTop='150' inputLeft='10'>
    <option text='Select' value='sel'/>
    <option text='Application' value='apps'/>
    <option text='Form' value='forms'/>
    <option text='Report' value='rpts'/>
  <item type='checkbox' name='appActive' label='Activate' tooltip='Makes application available in portal.' info='true' labelTop='190' labelLeft='12' inputTop='205' inputLeft='10'/>
  <item type='checkbox' name='createDB' label='Create DataBase' tooltip='Creates database for application (DB name = Directory name).' info='true' labelTop='190' labelLeft='95' inputTop='205' inputLeft='93'/>
  <item type='button' name='btn' value='Create' disabled='false' inputTop='245' inputLeft='12'/>

As I said, everything else works great. if I console.log(fwForm) the form code is there. But when I console.log(fwSelect) it returns null. What am I doing wrong?

Thank you,

You just need to call getSelect in callback function. As below:

var fwSelect; fwForm.loadStruct(appMgr.formStructure, function(){ fwSelect = fwForm.getSelect('appType'); });

Thank you, that works. Is there any built in method to remove an option from a select? I am using select.remove(0) and it works but, if there is a dhtmlx built in method, I would rather use it.

Again, thank you.


that’s correct, by the default form gives you ability to get select DOM element by form.getSelect() or options by form.getOptions(). but adding/removing you should you by script manually.