Skip to main content

How to clear or reset a form element

Comments

8 comments

  • Permanently deleted user

    Hi Carl,

     

    It looks like the geometry picker has a "state" property (an array) that's key to displaying and interacting with the selected geometry.

     

    Try adding a Clear Collection activity in your change event subworkflow, after the activity that clears the geometry value. For the collection value, use =$form1.state.geometryPicker1.state (or the equivalent to match your id's).

     

    You mentioned that your change event also removes the graphics layer of the geometry picker from the map. I would take this step out before testing with this change. It shouldn't be necessary to remove any out-of-the-box graphics layers manually (but if you added your own graphics layers somewhere then you might still want to).

    0
  • Permanently deleted user

    Thanks, Amanda! This does exactly what I need.

     

    It wasn't necessary to remove the graphics layer to get this to work.

    0
  • Wout Peters

    This does not seem to work for me...

     

    I have a geometryPicker with which I would like the user to click on the map. I will then use this point to query a polygon layer. If no polygon is found at the clicked location, I want the geometryPicker to "reset" (and if possible reuse the 'Auto-Activate' capability of the geometryPicker), so that the user does not need to delete the previous point.

     

    I tried using the 'Clear Collection' with =$form1.state.geometryPicker1.state. It does not do anything for me...

     

    Any help is appreciated

    0
  • Nelson Dobbs

    Use a "Set Form Element Property" activity:

    Element: =$form1.state.geometryPicker1

    Property Name: value

    Leave the rest blank.

     

    After that Activity add this:

    Activity: Set Form Element Property

    Element: =$form1.state.geometryPicker1

    Property Name: autoActivate

    Property Value: true

    0
  • Permanently deleted user

    @Nelson Dobbs? This method works fine to clear the geometry. However, after adding a new geometry with the same geometry picker, I find that the old geometry gets restored instead. Or at least the markup of the old geometry: I can retrieve the value of the new geometry, but the yellow markup that shows is from the first added geometry. Any ideas how that works..? How can I also reset the Graphics Layer/Markup of the geometry picker?

    0
  • Jostein Svegården

    Using Clear Collection to clear an Item Picker's state doesn't seem to work in Geocortex Mobile. Error says: "Input collection was invalid. Expected type System.Collections.IList". Looking at the input to Clear Collection, I see it is a System.Collections.Generic.List. This class implements the IList-interface, so this should not be a problem. @Amanda Frech? 

    0
  • Permanently deleted user

    @Jostein Svegården? What's your input on the Clear Collection activity? You mentioned clearing an Item Picker- are you referencing a property directly from the item picker form element, or some other value that's used to later generate the form element items? Just looking for a way to try to test this out on my end accurately.

    0
  • Jostein Svegården

    Input is $form1.state.geometryPicker1.state - just the same as you proposed at the top of this post

    0

Please sign in to leave a comment.