Hoppa till huvudinnehållet

Use the Set Form Element Property on an AutoComplete text box.

Kommentarer

17 kommentarer

  • Nico Burgerhart

    Which property are you trying to set?

    0
  • Robert Pincus

    Its value. I am able to get the text entered by using this syntax $form2.state.parcel_AutoComplete.value, but not set it.

    0
  • Permanently deleted user

    @Robert Pincus? try setting the "label" property instead of the "value" one. For autocomplete, the "label" is what you see in the box where you type, and "value" is a hidden property that only gets set if you type a few letters and then pick an option from the suggestions list.

    0
  • Chad Bergeson

    I'm trying to 'reset' my AutoComplete back to nothing so the placeholder text displays.  Setting the label property as suggested above works as long as I set it to something but if I try to set it to nothing (i.e. ="") the label doesn't change.  Any thoughts or suggestions?

    1
  • Jenny Oh

    Did you figure out a solution for this? I am also trying to clear my autoComplete . 

    1
  • Chad Bergeson

    I have a ticket in with tech support that I'm waiting to hear back on.  I'll post here when/if I get a solution.

    1
  • Alex Videka

    Chad Bergeson Jenny Oh was a solution ever found? Trying to do this as well.

    0
  • Chad Bergeson

    I'm running VSWF 5.32 and it does not seem to have been fixed.  My tech support ticket did identify a pre-existing bug (#198123) maybe you could report the same thing an get attached as stakeholders to increase the priority of getting this fixed?

    1
  • Jenny Oh

    If I set the label to ="  " with a space within the quotes. It resets the label.  

    1
  • Chad Bergeson

    Hi Jenny,

    When I do that the autocomplete box ends up with the double quotes and space in it which needs to be selected & deleted before entering the next search string.  I'd like it to revert back to it's initials state with the value from the placeholder text (i.e. prompt) attribute visible.

    Does yours actually reset back to the initial state and if so can you share where (i.e. which event) your running the 'Set Form Element Property' activity from and maybe a screenshot of the inputs?

    Thanks,

    -Chad

    1
  • Zack Robison

    Chad Bergeson, it sounds like you didn't include the equals sign to indicate to WF that the input to that activity argument be interpreted as an expression not a string, check out the intro on expressions for a little more clarity there.

    Side note for posterity, I just played around with this and was able to make it work with the space suggested by Jenny as well as an empty string (=''), undefined (=undefined), and property deletion using Evaluate Expression (=delete $form.state.autoComplete1.value/label).  I updated both the autoComplete element's label and value properties.

    1
  • Alex Videka

    Hi All,

    Thanks for the follow ups and further suggestions. I have attempted Jenny and all of Zack's suggestions in my environment (VertiGIS Studio Workflow v5.33.0 & VertiGIS Studio Web v5.23.0) to no avail.

    I actually stumbled upon the 'easy' way to do this which is to set the 'Reset' property on the form containing the autocomplete to 'true' and this also does not appear to work. In all cases, the autocomplete box retains the value first selected at the beginning of the workflow. I will follow up on Chad's suggestion and add myself to the stakeholder list for the existing bug.

    0
  • Chad Bergeson

    Unfortunately I'm in the same boat as you Alex Videka, no matter what I try I can't get the autocomplete to reset.

    I wonder Zack Robison and Jenny Oh are you testing in the workflow sandbox or a VSW app?  I ask because I've gotten inconsistent results where it works in the sandbox but not VSW...  Anyway, many thanks I also appreciate the feedback and suggestions!

    -Chad

    1
  • Zack Robison

    Chad Bergeson, you were absolutely right that I was testing in the sandbox.  My VSW behavior matched yours, but I found a workaround.  After updating the element properties (label ='', delete value) I run Show Form Element with a visibility =false, a Delay of 0ms, then Show Form Element on the autocomplete.

    The Delay was essential, even though it didn't really delay anything.  I also tried placing a Create Value in that location, which did not work when empty but did work when set ='asdf'.  Trying to run the Show immediately after the Hide did not work.  Also, it did not work to use the Hide Element activity instead of the Show activity with visibility false.

    0
  • Chad Bergeson

    Hi Zach,

    Thanks for your continued assistance unfortunately I'm still not getting the autoComplete to reset. Where are you running these activities?  I've tried the load event for the field and in the regular sequence of the workflow.  Also could you possibly export your workflow and paste the JSON to this post?

    Thanks,

    -Chad

    0
  • Zack Robison

    I have the activities running in a button's click event.  Here's the JSON

    {"_properties":{"isServerWorkflow":false},"components":[{"id":2,"steps":[{"id":3,"inputs":{},"position":"0,0","purpose":"start","title":"Start","transitions":[{"id":6,"inputs":{},"position":"90,60 90,110","target":{"id":4}}]},{"action":"gcx:wf:forms:form:DisplayForm","id":4,"inputs":{"form":{"accessors":[],"code":"resources.forms[values.id]","values":{"id":5}}},"name":"form1","position":"-30,110","title":"Display Form"}]},{"id":7,"steps":[{"id":8,"inputs":{},"position":"0,0","purpose":"start","title":"Event","transitions":[{"id":15,"inputs":{},"position":"90,60 90,110","target":{"id":10}}]},{"action":"gcx:wf:forms::GetFormEventData","description":"Get the current value from the AutoComplete element.","id":10,"inputs":{"form":{"accessors":["$$form"],"code":"$$form","source":"$$form"}},"name":"formEventData1","position":"-30,110","title":"Get Form Event Data","transitions":[{"id":16,"inputs":{},"position":"90,220 90,270","target":{"id":11}}]},{"action":"gcx:wf:core::TextReplace","description":"Escape apostrophe characters to avoid SQL injection and broken queries.","id":11,"inputs":{"newValue":"''","oldValue":"'","text":{"accessors":["$formEventData1"],"code":"$formEventData1.argument","source":"$formEventData1.argument"}},"name":"textReplace1","position":"-30,270","title":"Text Replace","transitions":[{"id":17,"inputs":{},"position":"90,400 90,450","target":{"id":12}}]},{"action":"gcx:wf:arcgis:query:QueryTask","description":"Query for features.","id":12,"inputs":{"outFields":"STATE_NAME,POP2007","returnGeometry":false,"url":"https://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/3","where":{"accessors":["$textReplace1"],"code":"\"UPPER(STATE_NAME) LIKE UPPER('\" + $textReplace1.result + \"%')\"","source":"`UPPER(STATE_NAME) LIKE UPPER('${$textReplace1.result}%')`"}},"name":"query1","position":"-30,450","title":"Query Layer","transitions":[{"id":18,"inputs":{},"position":"90,550 90,600","target":{"id":13}}]},{"action":"gcx:wf:forms::GetFormElementItemsFromFeatures","description":"Convert the features into form element items to be used in the element.","id":13,"inputs":{"features":{"accessors":["$query1"],"code":"$query1.features","source":"$query1.features"},"labelFieldName":"STATE_NAME"},"name":"formElementItems1","position":"-30,600","title":"Get Form Element Items From Features","transitions":[{"id":19,"inputs":{},"position":"90,730 90,780","target":{"id":14}}]},{"action":"gcx:wf:forms::SetFormElementItems","description":"Assign form element items to the element.","id":14,"inputs":{"form":{"accessors":["$$form"],"code":"$$form","source":"$$form"},"items":{"accessors":["$formElementItems1"],"code":"$formElementItems1.items","source":"$formElementItems1.items"}},"position":"-30,780","title":"Set Form Element Items"}],"title":"suggest-autoComplete1"},{"id":20,"steps":[{"id":21,"inputs":{},"position":"0,0","purpose":"start","title":"Event","transitions":[{"id":57,"inputs":{},"position":"90,60 90,120","sourceConnector":"bottom","target":{"id":23}}]},{"action":"gcx:wf:forms::SetFormElementProperty","id":23,"inputs":{"elementName":{"accessors":["$form1"],"annotations":[{"count":6,"index":0,"kind":"idref"}],"code":"$form1.state.autoComplete1","source":"$form1.state.autoComplete1"},"form":{"accessors":["$$form"],"code":"$$form","source":"$$form"},"propertyName":"label","propertyValue":{"accessors":[],"code":"''","source":"''"}},"position":"-30,120","title":"Set label","transitions":[{"id":26,"inputs":{},"position":"90,150 90,170 -50,170 -50,265 -70,265","sourceConnector":"bottom","target":{"id":28}}]},{"action":"gcx:wf:forms::SetFormElementProperty","id":25,"inputs":{"elementName":{"accessors":["$form1"],"annotations":[{"count":6,"index":0,"kind":"idref"}],"code":"$form1.state.autoComplete1","source":"$form1.state.autoComplete1"},"form":{"accessors":["$$form"],"code":"$$form","source":"$$form"},"propertyName":"value","propertyValue":{"accessors":[],"annotations":[],"code":"null","source":"null"}},"position":"-30,190","title":"Set Form Element Property"},{"action":"gcx:wf:core::Evaluate","id":27,"inputs":{"expression":{"accessors":["$form1"],"annotations":[{"count":6,"index":7,"kind":"idref"}],"code":"delete $form1.state.autoComplete1.label","source":"delete $form1.state.autoComplete1.label"}},"name":"evaluate1","position":"-310,120","title":"Label","transitions":[{"id":29,"inputs":{},"position":"-190,190 -190,230","sourceConnector":"bottom","target":{"id":28}}]},{"action":"gcx:wf:core::Evaluate","id":28,"inputs":{"expression":{"accessors":["$form1"],"annotations":[{"count":6,"index":7,"kind":"idref"}],"code":"delete $form1.state.autoComplete1.value","source":"delete $form1.state.autoComplete1.value"}},"name":"evaluate2","position":"-310,230","title":"Delete value","transitions":[{"id":36,"inputs":{},"position":"-190,300 -190,320 240,320 240,555 290,555","sourceConnector":"bottom","target":{"id":55}}]},{"action":"gcx:wf:core::Evaluate","id":32,"inputs":{"expression":{"accessors":["$form1"],"annotations":[{"count":6,"index":7,"kind":"idref"}],"code":"delete $form1.state.autoComplete1.current","source":"delete $form1.state.autoComplete1.current"}},"name":"evaluate3","position":"-310,340","title":"delete current","transitions":[{"id":69,"inputs":{},"position":"-70,375 90,375 90,605 110,605","sourceConnector":"right","target":{"id":70}}]},{"action":"gcx:wf:core::Evaluate","id":35,"inputs":{"expression":{"accessors":["$form1"],"annotations":[{"count":6,"index":7,"kind":"idref"}],"code":"delete $form1.state.autoComplete1.value","source":"delete $form1.state.autoComplete1.value"}},"name":"evaluate4","position":"-310,450","title":"Evaluate Expression"},{"action":"gcx:wf:forms::SetFormElementItems","id":38,"inputs":{"elementName":{"accessors":["$form1"],"annotations":[{"count":6,"index":0,"kind":"idref"}],"code":"$form1.state.autoComplete1","source":"$form1.state.autoComplete1"},"form":{"accessors":["$$form"],"code":"$$form","source":"$$form"},"items":{"accessors":["$formElementItems2"],"annotations":[{"count":18,"index":0,"kind":"idref"}],"code":"$formElementItems2.items","source":"$formElementItems2.items"},"reset":{"accessors":[],"code":"true","source":"true"}},"position":"260,230","title":"Set Form Element Items","transitions":[{"id":45,"inputs":{},"position":"380,260 380,300","target":{"id":44}}]},{"action":"gcx:wf:forms::GetFormElementItemsFromCollection","id":39,"inputs":{"collection":{"accessors":[],"annotations":[],"code":"[]","source":"[]"}},"name":"formElementItems2","position":"260,120","title":"Get Form Element Items From Collection","transitions":[{"id":40,"inputs":{},"position":"380,190 380,230","sourceConnector":"bottom","target":{"id":38},"targetConnector":"top"}]},{"action":"gcx:wf:core::Evaluate","id":44,"inputs":{"expression":{"accessors":["$form1"],"annotations":[{"count":6,"index":0,"kind":"idref"}],"code":"$form1.actor.refresh()","source":"$form1.actor.refresh()"}},"name":"evaluate5","position":"260,300","title":"actor.refresh()"},{"action":"gcx:wf:forms::ShowFormElement","id":49,"inputs":{"elementName":{"accessors":["$form1"],"annotations":[{"count":6,"index":0,"kind":"idref"}],"code":"$form1.state.autoComplete1","source":"$form1.state.autoComplete1"},"form":{"accessors":["$$form"],"code":"$$form","source":"$$form"},"visible":{"accessors":["$form1"],"annotations":[{"count":6,"index":1,"kind":"idref"}],"code":"!$form1.state.autoComplete1.visible","source":"!$form1.state.autoComplete1.visible"}},"position":"260,440","title":"Toggle Visibility"},{"action":"gcx:wf:forms::ShowFormElement","id":51,"inputs":{"elementName":{"accessors":["$form1"],"annotations":[{"count":6,"index":0,"kind":"idref"}],"code":"$form1.state.autoComplete1","source":"$form1.state.autoComplete1"},"form":{"accessors":["$$form"],"code":"$$form","source":"$$form"}},"position":"110,710","title":"Show Form Element"},{"action":"gcx:wf:forms::ShowFormElement","id":55,"inputs":{"elementName":{"accessors":["$form1"],"annotations":[{"count":6,"index":0,"kind":"idref"}],"code":"$form1.state.autoComplete1","source":"$form1.state.autoComplete1"},"form":{"accessors":["$$form"],"annotations":[{"count":6,"index":0,"kind":"idref"}],"code":"$$form","source":"$$form"},"visible":{"accessors":["$form1"],"annotations":[{"count":6,"index":1,"kind":"idref"}],"code":"!$form1.state.autoComplete1.visible","source":"!$form1.state.autoComplete1.visible"}},"position":"290,540","title":"Hide","transitions":[{"id":61,"inputs":{},"position":"410,570 410,665 350,665","sourceConnector":"bottom","target":{"id":58}}]},{"action":"gcx:wf:core::Delay","id":58,"inputs":{"duration":0},"position":"110,650","title":"Delay","transitions":[{"id":60,"inputs":{},"position":"230,680 230,710","sourceConnector":"bottom","target":{"id":51},"targetConnector":"top"}]},{"action":"gcx:wf:core::CreateValue","id":62,"inputs":{"expression":{"accessors":[],"code":"'asdf'","source":"'asdf'"}},"name":"value1","position":"-210,630","title":"Create Value","transitions":[{"id":63,"inputs":{},"position":"-90,700 -90,725 110,725","sourceConnector":"bottom","target":{"id":51}}]},{"action":"gcx:wf:forms::HideFormElement","id":70,"inputs":{"elementName":{"accessors":["$form1"],"annotations":[{"count":6,"index":0,"kind":"idref"}],"code":"$form1.state.autoComplete1","source":"$form1.state.autoComplete1"},"form":{"accessors":["$$form"],"code":"$$form","source":"$$form"}},"position":"110,590","title":"Hide Form Element","transitions":[{"id":71,"inputs":{},"position":"230,620 230,605 -90,630","sourceConnector":"bottom","target":{"id":62},"targetConnector":"top"}]}],"title":"click-buttonBar1"}],"deploymentConfig":{"supportedApps":{"GWV":true}},"designerVersion":"5.29.0+32","forms":[{"defaults":{},"elements":{"autoComplete1":{"enabled":true,"index":0,"prompt":{"markdown":"Start typing a value"},"rowIndex":0,"rowNumber":0,"title":{"markdown":"Auto Complete"},"type":"AutoComplete"},"buttonBar1":{"enabled":true,"index":1,"items":{"0":{"index":0,"label":{"markdown":"Clear"}}},"rowIndex":0,"rowNumber":1,"type":"ButtonBar"},"footer":{"enabled":true,"items":{"0":{"default":true,"index":0,"label":{"markdown":"Submit"},"validates":true,"value":"submit"},"1":{"index":1,"label":{"markdown":"Cancel"},"validates":false,"value":"cancel"}},"section":"footer","type":"ButtonBar"},"header":{"section":"header","title":{"markdown":"Form Title"},"type":"Header"}},"id":5}],"licenseInfo":{"licenseUrl":"https://apps.digitaldataservices.com/geocortex/workflow/service/auth/license"},"start":{"id":3},"transitions":[{"branch":"suggest$autoComplete1","id":9,"inputs":{},"source":{"id":4},"target":{"id":8}},{"branch":"clicked$buttonBar1","id":22,"inputs":{},"source":{"id":4},"target":{"id":21}}]}
    1
  • Chad Bergeson

    Thank you Zack Robison I was able to get it working!

    0

Du måste logga in om du vill lämna en kommentar.