Copy readonly text in form via button (or ... menu)

Hello Community,

I have a form field (logging records) which needs to have the same text as the previous record.

I would like to copy the text (‘Terrein maaien’ in this case) via a button so that it can be pasted in a new record.

Via a ‘copy’ button would be ideal or via a 3-dotted menu.

Thanks for your input

hello @marc_boelaers !

I think the only way to add such a button would be to create a plugin. I have thought of other alternatives that can be achievable just by configuring your project:

  • If you specifically need to get a value from the previous record (e.g. the last value from your layer), I think you can auto-populate your new attribute using a Default Value Expression. You’ll probably need to use a function such as attribute() and pass it the previous feature with get_feature(), similar to what is explained on this stackExchange question. I think you should be able to get the fid of your current feature and remove it by 1 and get the previous feature on your layer.
  • Other option would be to have a dropdown with all the values already used for that attribute. In that case, QField can give you an autocomplete function, plus a search function; with both of those, you can significantly reduce the chances of misstyping the values. You can check this video to get an idea of how this works.

Did you know that QField can autocomplete the value from the last record ? :wink:
More info there : "Remember last value" pins don't show up in feature addition form · Issue #7169 · opengisch/QField · GitHub