AnsweredAssumed Answered

Why can't I add my points to my map after changing variables?

Question asked by csergent08 Champion on Jul 17, 2015
Latest reply on Aug 21, 2015 by csergent08

I updated variable in my application and it was adding supports and signs before, but now it's not. I have an updated project at: csergent45/streetSigns at ee7def64d6ffd77f78e7a9516e10942a8951b6f8 · GitHub  Here are the two blocks of code that appear not to work:

// get attributes from form and submit  
    var addSupports = function () {
        
        //alert(domClass.contains("attributesModal", "in"));


        var attributes = {
            // TODO: not sure if this is needed  
            //requestreceived: null
        };
        var currentDate = new Date(); // current date is defined but never used.
        var graphic;
                
        
        graphic = new Graphic(app.currentGeometry);
        
        query("#attributesModal input, #attributesModal select, #attributesModal textarea").forEach(function (formInput) {
            attributes[formInput.name] = formInput.value;
        });
       
        // Form Validation - ensures that the values for the database are here if left blank
        if ((attributes.SUPPORTID === undefined) || (attributes.SUPPORTID === "")) {
            attributes.SUPPORTID = null;
        }
        if ((attributes.DATEINV === undefined) || (attributes.DATEINV === "")) {
            attributes.DATEINV = null;
        }
        if ((attributes.ADDRCODE === undefined) || (attributes.ADDRCODE === "")) {
            attributes.ADDRCODE = null;
        }        


        
        
        //graphic.setAttributes(attributes);
        stopCaptureRequest();
        
       
        //console.log(attributes);  
        app.supportLayer.applyEdits([graphic], null, null).then(function (response) {
            console.log(response);
            app.supportLayer.refresh();
            
        });
        
    };

 

 

// get sign attributes from form and submit
    var addSigns = function () {


       // alert(domClass.contains("attributesSignModal", "in"));


        var attributes = {
            // TODO: not sure if this is needed  
            //requestreceived: null
        };
        var currentDate = new Date(); // current date is defined but never used.
        var graphic;




        graphic = new Graphic(app.currentGeometry);


        query("#attributesSignModal input, #attributesSignModal select, #attributesSignModal textarea").forEach(function(formInput) {
            attributes[formInput.name] = formInput.value;
        });


        // Form validation - ensures that the values for the data are here if left blank
        if ((attributes.sign_INSTALLED === undefined)|| (attributes.sign_INSTALLED === "")) {
            attributes.sign_INSTALLED = null;
        }
        if ((attributes.sign_SIGNID === undefined) || (attributes.sign_SIGNID === "")) {
            attributes.sign_SIGNID = null;
        }
        if ((attributes.sign_SUPPORTID === undefined) || (attributes.sign_SUPPORTID === "")) {
            attributes.signSUPPORTID = null;
        }




        attributes.supportId = attributes.sign_SUPPORID;
        delete attributes.sign_SUPPORTID;


        graphic.setAttributes(attributes);
        stopCaptureRequest();


        console.log(attributes);  
        app.signLayer.applyEdits([graphic], null, null).then(function (response) {
            console.log(response);
            app.signLayer.refresh();
            
        });




    };

 

The forms for each of these are as follows:

Support Form

 <!-- attribute editor modal Begin -->
    <form id="supportForm">
    <div id="attributesModal" class="modal fade" style="display: none;" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                    <h4 class="modal-title">Add/Edit Street Support</h4>
                </div>
                <!-- Street Support Modal Body Begin -->
                <div class="modal-body">
                    <div class="form-group">
                        <label for="OBJECTID">Object ID</label>
                        <input type="number" class="form-control" name="OBJECTID" id="OBJECTID" readonly>
                    </div>
                    <!-- Address Begin -->
                    <div class="form-group">
                        <label for="ADDRESS">Address</label>
                        <input type="text" class="form-control" placeholder="Address" name="ADDRESS" id="ADDRESS" />
                    </div>
                    <!-- Address End -->


                    <!-- Begin Support ID -->
                    <div class="form-group">
                        <label for="SUPPORTID">Support ID</label>
                        <input type="number" class="form-control" name="SUPPORTID" id="SUPPORTID" />
                    </div>
                    <!-- End Support ID -->


                    <!-- Begin Type -->
                    <div class="form-group">
                        <label for="TYPE">Type</label>
                        <select id="TYPE" class="form-control" name="TYPE" required>
                            
                        </select>
                    </div>
                    <!-- End Type -->


                    <!-- Begin Size -->
                    <div class="form-group">
                        <label for="SIZE_">Size</label>
                        <select id="SIZE_" name="SIZE_" class="form-control" required>
                            
                        </select>
                    </div>
                    <!-- End Size -->
                    <!-- Begin Material -->
                    <div class="form-group">
                        <label for="MATERIAL">Material</label>
                        <select id="MATERIAL" name="MATERIAL" class="form-control" required>
                            
                        </select>
                    </div>
                    <!-- End Material -->
                    <!-- Begin Base -->
                    <div class="form-group">
                        <label for="BASE">Base</label>
                        <select id="BASE" name="BASE" class="form-control" required>
                           
                        </select>
                    </div>
                    <!-- End Base -->
                    <!-- Rating Begin -->
                    <div class="form-group">
                        <label for="RATING">Rating</label>
                        <select id="RATING" name="RATING" class="form-control" required>
                            
                        </select>
                    </div>
                    <!-- Rating End -->


                    <!-- Date Inv Begin  -->
                    <div class="form-group">
                        <label for="DATEINV">Date Inv.</label>
                        <input type="date" class="form-control" name="DATEINV" id="DATEINV" />
                    </div>
                    <!-- Date Inv End -->


                    <!-- Inspector Begin -->
                    <div class="form-group">
                        <label for="INSPECTOR">Inspector</label>
                        <input type="text" class="form-control" placeholder="Inspector Name" name="INSPECTOR" id="INSPECTOR" />
                    </div>
                    <!-- Inspector End -->


                    <!-- Comments Begin -->
                    <div class="form-group">
                        <label for="COMMENTS">Comments</label>
                        <input type="text" class="form-control" placeholder="Comments" name="COMMENTS" id="COMMENTS" />
                    </div>
                    <!-- Comments End -->


                    <!-- Address Code Begin -->
                    <div class="form-group">
                        <label for="ADDRCODE">Addr. Code</label>
                        <input type="number" class="form-control" placeholder="Addr. Code" name="ADDRCODE" id="ADDRCODE" />
                    </div>
                    <!-- Address Code End -->


                    <button id="btnSupportSubmit" class="btn btn-success" type="submit" style="visibility:hidden">Submit</button> 
                    <button id="btnSupportUpdate" class="btn" type="submit" style="visibility:hidden">Update</button>
                    <button class="btn btn-default" type="button">Cancel</button>    
                    <button id="btnRelatedSigns" type="button" style="visibility:hidden">Signs</button>
                    


                </div>
                <!-- Street Support Modal Body End -->
            </div>
        </div>
    </div>
    </form>
    <!-- Attribute editor modal End-->

 

Signs form:

 <!-- Attributes Sign Modal Begin -->
    <form id="signForm">
        <div id="attributesSignModal" class="modal fade" style="display: none;" aria-hidden="true">
            <!-- Modal Dialog Begin -->
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                        <h4 class="modal-title">Add/Edit Sign</h4>
                    </div>
                    <div class="modal-body">
                        <div class="form-group">
                            <label for="sign_OBJECTID">Object ID</label>
                            <input type="number" class="form-control" name="sign_OBJECTID" id="sign_OBJECTID" readonly>
                        </div>
                        <!-- Mutcd Begin -->
                        <div class="form-group">
                            <label for="sign_MUTCD">MUTCD</label>
                            <select id="sign_MUTCD" class="form-control" name="sign_MUTCD" required></select>
                        </div>
                        <!-- Mutcd End -->
                        <!-- - Begin -->
                        <div class="form-group">
                            <label for="sign_INSTALLED">Installed</label>
                            <input type="date" class="form-control" name="sign_INSTALLED" id="sign_INSTALLED" />
                        </div>
                        <!-- Installed End -->
                        <!-- Sign ID Begin -->
                        <div class="form-group">
                            <label for="sign_SIGNID">Sign ID</label>
                            <input type="number" class="form-control" placeholder="Sign ID" name="sign_SIGNID" id="sign_SIGNID" />
                        </div>
                        <!-- Sign ID End -->
                        <!-- Facing Begin -->
                        <div class="form-group">
                            <label for="sign_FACING">Facing</label>
                            <input type="text" class="form-control" placeholder="Facing" name="sign_FACING" id="sign_FACING" />
                        </div>
                        <!-- Facing End -->
                        <!-- Visibility Begin -->
                        <div class="form-group">
                            <label for="sign_VISIBILITY">Visibility</label>
                            <select id="sign_VISIBILITY" class="form-control" name="sign_VISIBILITY" required></select>
                        </div>
                        <!-- Visibility End -->
                        <!-- Condition Begin -->
                        <div class="form-group">
                            <label for="sign_CONDITION_">Condition</label>
                            <select id="sign_CONDITION_" class="form-control" name="sign_CONDITION_" required></select>
                        </div>
                        <!-- Condition End -->
                        <!-- Support ID Begin -->
                        <div class="form-group">
                            <label for="sign_SUPPORTID">Support ID</label>
                            <input type="number" class="form-control" name="sign_SUPPORTID" id="sign_SUPPORTID" />
                        </div>
                        <!-- Support ID End -->
                        <!-- Text Begin -->
                        <div class="form-group">
                            <label for="sign_TEXT">Text</label>
                            <input type="text" class="form-control" name="sign_TEXT" id="sign_TEXT" />
                        </div>
                        <!-- Text End -->
                        <!-- Color 1 Begin -->
                        <div class="form-group">
                            <label for="sign_COLOR1">Color 1</label>
                            <select id="sign_COLOR1" class="form-control" name="sign_COLOR1" required></select>
                        </div>
                        <!-- Color 1 End -->
                        <!-- Delineator Begin -->
                        <div class="form-group">
                            <label for="sign_DELINEATOR">Delineator</label>
                            <select id="sign_DELINEATOR" class="form-control" name="sign_DELINEATOR" required></select>
                        </div>
                        <!-- Delineator End -->
                        <!-- Illum Begin -->
                        <div class="form-group">
                            <label for="sign_ILLUM">Illum</label>
                            <select id="sign_ILLUM" class="form-control" name="sign_ILLUM" required></select>
                        </div>
                        <!-- Illum End-->
                        <!-- Offset Begin -->
                        <div class="form-group">
                            <label for="sign_OFFSET">Offset</label>
                            <input type="text" class="form-control" name="sign_OFFSET" id="sign_OFFSET" />
                        </div>
                        <!-- Offset Ends -->
                        <!-- Mountht Begin -->
                        <div class="form-group">
                            <label for="sign_MOUNTHT">MOUNTHT</label>
                            <input type="text" class="form-control" name="sign_MOUNTHT" id="sign_MOUNTHT" />
                        </div>
                        <!-- Mountht End -->
                        <!-- Backing Begin -->
                        <div class="form-group">
                            <label for="sign_BACKING">Backing</label>
                            <select id="sign_BACKING" class="form-control" name="sign_BACKING" required></select>
                        </div>
                        <!-- Backing End -->
                        <!-- Width Begin -->
                        <div class="form-group">
                            <label for="sign_WIDTH">Width</label>
                            <input type="text" class="form-control" name="sign_WIDTH" id="sign_WIDTH" />
                        </div>
                        <!-- Width End -->
                        <!-- Height Begin -->
                        <div class="form-group">
                            <label for="sign_HEIGHT">Height</label>
                            <input type="text" class="form-control" name="sign_HEIGHT" id="sign_HEIGHT" />
                        </div>
                        <!-- Height End -->
                        <!-- Txt Size Begin -->
                        <div class="form-group">
                            <label for="sign_TXTSIZE">Text Size</label>
                            <input type="text" class="form-control" name="sign_TXTSIZE" id="sign_TXTSIZE" />
                        </div>
                        <!-- Txt Size End -->
                        <!-- Num Size Begin -->
                        <div class="form-group">
                            <label for="sign_NUMSIZE">Numsize</label>
                            <input type="text" class="form-control" name="sign_NUMSIZE" id="sign_NUMSIZE" />
                        </div>
                        <!-- Num Size End -->
                        <!-- Comments Begin -->
                        <div class="form-group">
                            <label for="sign_COMMENTS">Comments</label>
                            <input type="text" class="form-control" name="sign_COMMENTS" id="sign_COMMENTS" />
                        </div>
                        <!-- Comments End -->
                        <!-- Two Sided Begin -->
                        <div class="form-group">
                            <label for="sign_TWOSIDED">Two Sided</label>
                            <input type="text" class="form-control" name="sign_TWOSIDED" id="sign_TWOSIDED" />
                        </div>
                        <!-- Two Sided End -->
                        <!-- Attach Type Begin -->
                        <div class="form-group">
                            <label for="sign_ATTACHTYPE">Attach Type</label>
                            <select id="sign_ATTACHTYPE" class="form-control" name="sign_ATTACHTYPE" required></select>
                        </div>
                        <!-- Attach Type End -->
                        <!-- Attach Num Begin  -->
                        <div class="form-group">
                            <label for="sign_ATTACHNUM">Attach Num</label>
                            <input type="text" class="form-control" name="sign_ATTACHNUM" id="sign_ATTACHNUM" />
                        </div>
                        <!-- Attach Num End -->
                        <!-- Attach Loc Begin -->
                        <div class="form-group">
                            <label for="sign_ATTACHLOC">Attach Loc</label>
                            <select id="sign_ATTACHLOC" class="form-control" name="sign_ATTACHLOC" required></select>
                        </div>
                        <!-- Attach Loc End -->
                        <!-- siteObs Begin -->
                        <div class="form-group">
                            <label for="sign_SITEOBS">Siteobs</label>
                            <select id="sign_SITEOBS" class="form-control" name="sign_SITEOBS" required></select>
                        </div>
                        <!-- siteObs End -->
                        <!-- Sign Shape Begin -->
                        <div class="form-group">
                            <label for="sign_SIGNSHAPE">Sign Shape</label>
                            <select id="sign_SIGNSHAPE" class="form-control" name="sign_SIGNSHAPE" required></select>
                        </div>
                        <!-- Sign Shape End -->
                        <!-- Color 2 Begin -->
                        <div class="form-group">
                            <label for="sign_COLOR2">Color 2</label>
                            <select id="sign_COLOR2" class="form-control" name="sign_COLOR2" required></select>
                        </div>
                        <!-- Color 2 End -->








                        <button id="btnSignSubmit" class="btn btn-success" type="submit" style="visibility:hidden">Submit</button> 
                        <button id="btnSignUpdate" class="btn" type="submit" style="visibility:hidden">Update</button>
                        <button class="btn btn-default" type="button">Cancel</button>    
                        <button id="btnSignPrevious" type="button" style="visibility:hidden">Prev</button>  
                        <button id="btnSignNext" type="button" style="visibility:hidden">Next</button>


                    </div>
                </div>
            </div>
            <!-- Modal Dialog End -->
        </div>
    </form>
    <!-- Attributes Sign Modal End -->

Any ideas?

Outcomes