AnsweredAssumed Answered

Value not being returned from Function.

Question asked by csergent08 Champion on Apr 22, 2015

I am trying to get the value of severity globally so that I can determine which layer data will be entered into in a conditional statement, but when I add the return statement, the debugger still states that severity is undefined. Any ideas.

 

 // temporarily show alert when starting edits  
    // and then start listening for a map click  
    var startCaptureRequest = function (severity) {
        var listener;
        
        // NOTE: once user has clicked 'x' to dismiss  
        // this alert, it will no longer show up  
        domStyle.set(app.startEditAlert, 'display', '');
        setTimeout(function () {
            domStyle.set(app.startEditAlert, 'display', 'none');
        }, 3000);
        // save map point in app global and  
        listener = app.map.on('click', function (e) {
            listener.remove();
            // save map point in app global and  
            // show form to collect incident report  
            app.currentGeometry = e.mapPoint;
            
            if (severity == 0) {
                alert("This will show the signs form.");
            } else if (severity == 1) {
                app.attributesModal.modal('show');
            }
           
            
        });
        return severity;
        
    };

 

My complete code is on github: https://github.com/csergent45/streetSigns

Outcomes