graphics.SetAttributes not picking the input values

720
2
Jump to solution
12-09-2016 12:08 PM
by Anonymous User
Not applicable

Hi all,

I am using .setAttributes to a graphics in order to add the graphic and attributes to a feature layer. The problem I have is that s .setAttributes does not seem to work with my input values, except when it is hard coded.

projectarea.setAttributes({ "START_DATE": $("#tesr").val(), "FINISH_DATE": "09/09/2019", "Name": "Alex", "PROJECT_ID": "3", "TREE_COUNT": "3", "ACRES": "4" });

For example, This will not :

$("#tesr").val()

This will work:

"22"

This is my form:

 <form>
                  
                    <div class="form-group">
                        <div class="input-group">
                            <span class="input-group-addon">Project ID</span>
                            <input type="text" class="form-control" placeholder="Project ID" id="tesr">
                        </div>
                    </div>
                </form>‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Any idea what is wrong with what I am doing?

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Alex,

   ArcGIS Server is expecting UTC dates which means you have to take "09/09/2019" and convert it to UTC

var msDate = Date.parse("09/09/2019");‍‍‍

View solution in original post

2 Replies
by Anonymous User
Not applicable

Correction to that topic,

My problem is for the date values. They apparently don't transfer from Graphics attributes to feature layer. When it is hard coded, it works fine. Not too sure if it is because the START_DATE in feature layer is a date field?

Thanks,

Alex

projectarea.setAttributes({ "START_DATE": "09/09/2019", "FINISH_DATE": "09/09/2019", "Name": $("#tesr").val(), "PROJECT_ID": "3", "TREE_COUNT": "3", "ACRES": "4" });
                    console.log(projectarea);
                    featurelayerProject.applyEdits([projectarea], null, null, function () { console.log("Features updated!"); }, function (error) { console.log("Features not updated! ", error); });
RobertScheitlin__GISP
MVP Emeritus

Alex,

   ArcGIS Server is expecting UTC dates which means you have to take "09/09/2019" and convert it to UTC

var msDate = Date.parse("09/09/2019");‍‍‍