<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic How to update value of field in Editor Widget (4.x) in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-update-value-of-field-in-editor-widget-4-x/m-p/1078377#M73846</link>
    <description>&lt;P&gt;platform: Experience Builder Dev v1.4, Javascript API 4.19&lt;/P&gt;&lt;P&gt;I would like to update the value of a field in the Editor Widget. I have attempted to update featureFormViewModel.feature.attributes but this does not show up in the EditorWidget. I have attempted to refresh the layer of the view model without luck:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;editorWidget.viewModel.featureFormViewModel.layer.refresh()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've not yet tried to use applyEdits on the feature layer. It seems I should be able to update the data before sending off with this function.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const editorWidget = new Editor({view: view, container: container})

editorWidget.watch('viewModel.featureFormViewModel.feature', (newValue) =&amp;gt; {
    newValue.attributes.site_city = "New City"
}

const attributes = editorWidget.viewModel.featureFormViewModel.getValues()
console.log(attributes) //Updated city name is not shown in the attributes

const attributes = editorWidget.viewModel.featureFormViewModel.feature.attributes
console.log(attributes) //Updated city name IS shown in the attributes&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 13 Jul 2021 19:55:28 GMT</pubDate>
    <dc:creator>PhilLarkin1</dc:creator>
    <dc:date>2021-07-13T19:55:28Z</dc:date>
    <item>
      <title>How to update value of field in Editor Widget (4.x)</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-update-value-of-field-in-editor-widget-4-x/m-p/1078377#M73846</link>
      <description>&lt;P&gt;platform: Experience Builder Dev v1.4, Javascript API 4.19&lt;/P&gt;&lt;P&gt;I would like to update the value of a field in the Editor Widget. I have attempted to update featureFormViewModel.feature.attributes but this does not show up in the EditorWidget. I have attempted to refresh the layer of the view model without luck:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;editorWidget.viewModel.featureFormViewModel.layer.refresh()&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've not yet tried to use applyEdits on the feature layer. It seems I should be able to update the data before sending off with this function.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const editorWidget = new Editor({view: view, container: container})

editorWidget.watch('viewModel.featureFormViewModel.feature', (newValue) =&amp;gt; {
    newValue.attributes.site_city = "New City"
}

const attributes = editorWidget.viewModel.featureFormViewModel.getValues()
console.log(attributes) //Updated city name is not shown in the attributes

const attributes = editorWidget.viewModel.featureFormViewModel.feature.attributes
console.log(attributes) //Updated city name IS shown in the attributes&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jul 2021 19:55:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-update-value-of-field-in-editor-widget-4-x/m-p/1078377#M73846</guid>
      <dc:creator>PhilLarkin1</dc:creator>
      <dc:date>2021-07-13T19:55:28Z</dc:date>
    </item>
  </channel>
</rss>

