Updating class property with new selection from attachmentPicker

Hi, I got stuck with updating a class property after a selection in the attachmentPicker.

The value won’t update and I can’t figure out how to access the the new attachmentPicker value. See the last 3 lines of code:

{{velocity}}
## Set the recipe object and image property for the "Foody.RecipeClass"
#set($recipe = $doc.getObject('Foody.RecipeClass'))
#set($ImageProp = $recipe.getProperty('Image').value)
#set($editing = $xcontext.action == 'edit')

## Check if the page is in edit mode
#if($editing)

  ## Set parameters for the attachment picker
  #set($attachmentPickerParams = {
      'name': 'RecipeClass_Image',
      'value': $ImageProp,
      'data-search-scope': 'space:Foody',
      'data-upload-allowed': 'true',
      'data-accept': 'image/'
  })
  
  ## Display the attachment picker widget for selecting or uploading images
  {{html wiki="true" clean="false"}}
    #attachmentPicker($attachmentPickerParams)
  {{/html}}
  
  
  #set($NewImageProp = $attachmentPicker.value) ?????
  $recipe.set("Image", $NewImageProp )
  $doc.save("Updated Image property value of RecipeClass for this recipe from form input")

I just don’t quite understand the meaning of:

Suggest Attachments
This suggester displays the attachment (file) name and the attachment location. The suggestion icon is either a preview, if the attachment is an image or an icon that depends on the attachment media type. The value that is saved in the end is the attachment reference. The hidden page user preference is taken into account (e.g. attachments from hidden pages are not displayed by default).

https://www.xwiki.org/xwiki/bin/view/Documentation/DevGuide/FrontendResources/AutoSuggestWidget/#Attachments

Maybe you can give me a hint :smiley:

btw: best forum I have seen so far: beautiful, clean and clever