I am writing a code too fill combo box values to a form but I encounter the error that the registry is not defined even though it has been defined on line 40... Suggestions? Thank you.
require([ "dojo/ready", "dojo/on", "dojo/_base/connect", "dojo/dom", "dijit/registry", "dojo/dom-construct", "dojo/parser", "esri/arcgis/utils", "esri/domUtils", "esri/tasks/query", 'dijit/_WidgetsInTemplateMixin', 'dojox/xml/parser', 'dojox/data/XmlStore', 'esri/tasks/QueryTask',"dijit/Menu", "dijit/MenuItem",'dijit/form/Select', "dojo/domReady!"], function( ready, on, connect, dom, registry, domConstruct, parser, arcgisUtils, domUtils, Query, _WidgetsInTemplateMixin, parser, xmlParser, XmlStore, QueryTask, Menu, MenuItem, Select ){ parser.parse(); fillcountyselect(); }); function fillcountyselect(){ var select1 = registry.byId("countyfield"); select1.addOption( {label:"Select County", value: 0});
Solved! Go to Solution.
You also have a problem with your require modules/function arguments agreement. You have an extra "parcer" here:
_WidgetsInTemplateMixin, parser, xmlParser
Lefteris,
It looks like your combo fill function is outside your main function thus unreachable
Hello Lefteris,
Robert is right. Your function and the call for the registry.byId lies outside the above defined require.
If you set it up it like this :
function fillcountyselect(){
require(["dijit/registry"],function(registry){
var select1 = registry.byId("countyfield");
select1.addOption( {label:"Select County", value: 0});
....u.s.o.
});
}
you have access to "registry".
Regards
Thank you Miriam.
I still get a message that the "Cannot read property 'addOption' of undefined". It seems that the registry is still not recognized.
This is from the html.
<select style="margin-top:10px;margin-bottom:10px;" id="countyfield" data-dojo-attach-point="countyfield" data-dojo-type="dijit/form/Select" data-dojo-attach-event="onChange:_onCountyClick"></select>
You also have a problem with your require modules/function arguments agreement. You have an extra "parcer" here:
_WidgetsInTemplateMixin, parser, xmlParser
One of my select is populated by an xml file. So, using just xmlparser will be sufficient for the whole form?
Lefteris,
No Ken is talking about the fact that you have "parser" listed twice and xmlParser once.
on,connect,dom,registry,domConstruct,parser,arcgisUtils,domUtils,Query, _WidgetsInTemplateMixin, parser,xmlParser, XmlStore,QueryTask, Menu, MenuItem, Select
I need to have my eyes checked. How much time did I wasted for this! #$@$
Thank you all!
I ran across this post when I was also getting an undefined variable after using