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?
Solved! Go to Solution.
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");
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); });
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");