# Hide 'take picture' & 'choose image' buttons for image widget when defaults are being used

**URL:** <https://forum.getodk.org/t/hide-take-picture-choose-image-buttons-for-image-widget-when-defaults-are-being-used/42277>\
**Category:** Ideas\
**Tags:** odk-collect\
**Created:** [July 17, 2023, 1:20am UTC](https://forum.getodk.org/t/hide-take-picture-choose-image-buttons-for-image-widget-when-defaults-are-being-used/42277 "2023-07-17T01:20:25Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ahblake](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/ahblake/32/22392_2.png) [@ahblake](https://forum.getodk.org/u/ahblake)\
**Post date:** [July 17, 2023, 1:20am UTC](https://forum.getodk.org/t/hide-take-picture-choose-image-buttons-for-image-widget-when-defaults-are-being-used/42277/1 "2023-07-17T01:20:25Z")

</div>

**What high-level problem are you trying to solve?**  
When I design a form with a [default image](https://forum.getodk.org/t/dynamic-images-loaded-to-an-image-widget-from-a-choice-csv-selection/41921) that is loaded to the widget for annotation, it is possible for the enumerator to accidentally replace the default image if they are not paying attention.

They then need to discard the submission and start again or potentially don't realise what they've done and submit bad data. (This is not theoretical, it is happening to me and all I can do currently is put big red warning notes in the label)

Stretch: If someone is annotating and saves it, but realises they made a bad annotation, could there be a 'reload' button that could force the dynamic image to be reloaded to start again?

**Any ideas on how ODK could help you solve it?**  
If the 'Take Picture' and 'Choose Image' buttons were suppressed, and the only option was to annotate the image, then this error would be prevented.

This would be an appearance for the widget, similar to `annotate`, eg `no-capture`, `no-choose` would each suppress one button so the appearance value would be `annotate no-capture no-choose`, or a single `annotate_default` to apply all three flags.

I think this is possible and perhaps not that difficult (‽) as currently `annotate` is an appearance that "unsuppresses" a button, and there was recent discussion about changing visible buttons for sound recording:

> [@Making it required to “Record Sound” instead of “Choose Sound”](https://forum.getodk.org/t/making-it-required-to-record-sound-instead-of-choose-sound/42217/3):
>
> And for the folks who only want one primary action, they can hide the other button.

---

<div class="post-metadata">

**Author:** ![Aly\_Blenkin](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/aly_blenkin/32/19303_2.png) [@Aly\_Blenkin](https://forum.getodk.org/u/Aly_Blenkin)\
**Post date:** [July 19, 2023, 6:37pm UTC](https://forum.getodk.org/t/hide-take-picture-choose-image-buttons-for-image-widget-when-defaults-are-being-used/42277/2 "2023-07-19T18:37:30Z")

</div>

Thanks so much for sharing. This makes a lot of sense to me. If the user goal is to annotate the image, not 'Take Picture' and 'Choose Image' then hiding those buttons sounds like a good solution.

---

<div class="post-metadata">

**Author:** ![ahblake](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/ahblake/32/22392_2.png) [@ahblake](https://forum.getodk.org/u/ahblake)\
**Post date:** [February 16, 2024, 3:32am UTC](https://forum.getodk.org/t/hide-take-picture-choose-image-buttons-for-image-widget-when-defaults-are-being-used/42277/3 "2024-02-16T03:32:01Z")

</div>

Beyond removing 'take picture' and 'choose image' buttons, an additional button for this workflow that would be helpful for the use of default images would be a 'reset' (probably then with an 'Are you sure?' popup!), so that if the default had been annotated and saved but was in error, the default could be reloaded back in.

Currently in this case the submission needs to be trashed and restarted to reset the default, or adding a question that is only relevant when the image field is not `jr://images/...` and using it as a trigger to recalculate the default image in again.

---

<div class="post-metadata">

**Author:** ![Aly\_Blenkin](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/aly_blenkin/32/19303_2.png) [@Aly\_Blenkin](https://forum.getodk.org/u/Aly_Blenkin)\
**Post date:** [February 16, 2024, 7:09pm UTC](https://forum.getodk.org/t/hide-take-picture-choose-image-buttons-for-image-widget-when-defaults-are-being-used/42277/4 "2024-02-16T19:09:38Z")

</div>

Interesting idea! It's certainly not ideal to reload the default image this way, but at least there is a way to do it. How frequently do people need to reset default images?

I am also curious to hear from others who might have a similar need for resetting default images in their workflow. 💬

---

<div class="post-metadata">

**Author:** ![ahblake](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/ahblake/32/22392_2.png) [@ahblake](https://forum.getodk.org/u/ahblake)\
**Post date:** [August 16, 2024, 12:24am UTC](https://forum.getodk.org/t/hide-take-picture-choose-image-buttons-for-image-widget-when-defaults-are-being-used/42277/5 "2024-08-16T00:24:05Z")

</div>

> [@Aly\_Blenkin](#):
>
> How frequently do people need to reset default images?

I realise I didn't reply to this, sorry!

It happens reasonably often - if they muck up the annotation and have saved it, there's no way to restore to the original, and if they accidentally 'take picture' and replace the default that is supposed to be annotated.

I tried various methods to trigger the default but as a trigger can't be an `or` expression they have to change some selections back and forth, which will also have other effects on already answered questions.

I see there's an [issue](https://github.com/getodk/collect/issues/6241) for hiding take/choose, so one cause of needing a reset (taking a photo) will hopefully soon be avoidable.

---

<div class="post-metadata">

**Author:** ![Xiphware](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/xiphware/32/2587_2.png) [@Xiphware](https://forum.getodk.org/u/Xiphware)\
**Post date:** [August 19, 2024, 12:53am UTC](https://forum.getodk.org/t/hide-take-picture-choose-image-buttons-for-image-widget-when-defaults-are-being-used/42277/6 "2024-08-19T00:53:18Z")

</div>

> [@ahblake](#):
>
> I tried various methods to trigger the default but as a trigger can't be an `or` expression...

Yes and no... The manner in which [triggers](https://xlsform.org/en/#trigger) are defined _in XLSForm_ means that no, you cannot have a **dependent** question being 'triggered' by anything other than a change in a _single_ so-called **antecedent** question [aside, I discuss this limitation, albeit in a difference context, in some detail here: [Spec proposal: expose xforms-value-changed event with odk:setgeopoint action in XLSForm](https://forum.getodk.org/t/spec-proposal-expose-xforms-value-changed-event-with-odk-setgeopoint-action-in-xlsform/48655)]. Which is to say, Question B can only be 'triggered' by a change in Question A, not as you say a change in Question A _or_ C.

However, under the covers in raw XForms, there is actually nothing to prevent you performing _multiple_ **xforms-value-changed** event triggered **setvalue** actions - which is bascially what an XLSForm trigger becomes - to accomplish this. That is, you can actually have Question B be recalculated whenever Question A changes **or** when Question C changes (in fact they can even perform completely different calculations!)

Have a play with this XForm. It essentially consists of two different types of multi-triggers. The first triggers the same calculation whenever either of two antecedent questions change; basically your "trigger can't be an `or` expression" situation. The second set is a min/max example that readjusts a previously entered value should the min or max then be adjusted.

[MultiTriggers.xml](https://forum.getodk.org/uploads/short-url/gqPnITOaT7TK7DPfo4zwzriRqUO.xml) (2.3 KB)

 ![Screenshot 2024-08-19 at 12.52.33 PM](https://getodk.b-cdn.net/uploads/default/original/3X/e/0/e0158c6ad66b20b12554c482840f73401ca7a44a.png)

I'm not 100% sure of your specific usecase around restoring original images, but - at least in terms of being able to have an `or` expression of some form as a trigger - perhaps this could be helpful?

---

<div class="post-metadata">

**Author:** ![ahblake](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/ahblake/32/22392_2.png) [@ahblake](https://forum.getodk.org/u/ahblake)\
**Post date:** [August 22, 2024, 5:54am UTC](https://forum.getodk.org/t/hide-take-picture-choose-image-buttons-for-image-widget-when-defaults-are-being-used/42277/7 "2024-08-22T05:54:44Z")

</div>

> [@Xiphware](#):
>
> Yes and no...

Thanks as always for the detailed explanation. I should have said 'an XLSForm trigger can't be an or expression' as @LN has previously explained this to me. In practice, I'm not directly authoring XForms or converting and editing XML, so for all intents and purposes, to me today, triggers can only practically be single values.
