After some valuable inputs I have reworked this example to cater for the GOTCHA where a user deletes an image in the middle of the sequence of photos - lets hope its fool proof now! It definitely isnt perfect but hopefully it gives someone else out there an idea of what can be done - and with a little extra effort make it completely fool proof...
Do you have the requirement that your field workers might want to take/attach multiple photos to a survey but you dont want to use a repeat to capture them, since you know its harder to access those photos later? Just adding multiple image fields to your survey leaves your user interface cluttered like this:
Thats pretty ugly right?
One solution to unclutter the interface is to show the second photo field only once a user has already taken a photo. And after the user took the second photo, the third photo field becomes available... etc etc...
That can be achieved easily by setting the relevant field of each photo field with a calculation such as checking the value of the previous photo field:
The trick to get this to work when a user decides to delete a photo in the middle of a sequence of photos already added is to do the relevant calculation only once with the help of the once() function.
Doesn't this look much less cluttered:
After taking the first photo, the second one is opened up: