AnsweredAssumed Answered

calling functions from html script, using AMD syntax

Question asked by dmarquardt on Sep 4, 2013
Latest reply on Oct 26, 2016 by frivera4434
Hi,

I???m having problems adjusting my functions to the AMD syntax.

I have some html checkboxes that call a update visibility function.  I have some scripting in the html code that passes on unique arguments to the function.  In the legacy script, this worked fine.  When I transferred over to the AMD syntax (putting all functions inside the AMD require statement), the update visibility function is not recognized by the html code. But, if I take the function out of the require statement, the html scripting recognizes it.  In this situation, though, the update visibility function can't recognize any of the modules or elements left in the require statement.   How do I call a function from an html script that's inside the require statement?

Here???s the stripped down format I have that doesn???t work

<script src="http://js.arcgis.com/3.6/" type="text/javascript"></script>
<script  type="text/javascript">

require([ a bunch of modules ], function ( modules) {
  ready (function() {
    map = ???..           
    function updateLayerVisibility (arg1, arg2) { ???..}                                               
});
});

</script>
<body>
  <input type='checkbox' class='list_item' id='foodLyr3' value=3 onclick='updateLayerVisibility(arg1, arg2);'  /></input>
</body>

Outcomes