Confirm Answer Delete/Overwrite

471
3
Jump to solution
07-08-2020 04:59 PM
RyleeLam
New Contributor

I have a large survey with a number of conditional questions organised into pages. The first question of the survey determines the content of the remaining survey, i.e.:

Question 1: Where are you?

  • Home
  • Work

Where the user selects "Home", questions relevant to "Home" will appear to be answered by the user. However if the user was reviewing their survey answers and as they are scrolling through they accidentally select "Work" in Question 1, then the "Home" questions will be replaced by the "Work" questions, thereby resulting in a loss of those previously answered "Home" questions.

Is there a way to have a confirmation notification or similar (i.e. "Are you sure you wish to change this answer? Some data may be lost.") to help prevent accidental loss of data when a previous answer is changed?

Thanks!

0 Kudos
1 Solution

Accepted Solutions
DougBrowning
MVP Notable Contributor

Funny I just had to do this yesterday.

The way I did it is to add a formula to the read only column.  In once case I did it where this formula looks at a field later in the form to see if it is filled out.  So Direction says Forward or backward then I put a read only formula of ${RecKey}!=''.  This way as soon as they fill it out Direction goes read only.

In other form I base it on a repeat count.  The repeat is relevant based on Direction question not being ''.  Once they fill in direction the repeat shows.  Then in the repeat I have a count once(count(${RecKey})).  Once the repeat shows up and they hit + the first record is created making the count = 1.  I then have ${RecCount}>0 in the read only field of Direction. 

That is hard to type out so I hope it makes sense.  Pretty slick.  Basically pick a later question and go read only once they fill it out.

Maybe images will help.

Before

Repeat appears

Once they hit the + Direction goes read only.

Hope that helps.

View solution in original post

3 Replies
DougBrowning
MVP Notable Contributor

Funny I just had to do this yesterday.

The way I did it is to add a formula to the read only column.  In once case I did it where this formula looks at a field later in the form to see if it is filled out.  So Direction says Forward or backward then I put a read only formula of ${RecKey}!=''.  This way as soon as they fill it out Direction goes read only.

In other form I base it on a repeat count.  The repeat is relevant based on Direction question not being ''.  Once they fill in direction the repeat shows.  Then in the repeat I have a count once(count(${RecKey})).  Once the repeat shows up and they hit + the first record is created making the count = 1.  I then have ${RecCount}>0 in the read only field of Direction. 

That is hard to type out so I hope it makes sense.  Pretty slick.  Basically pick a later question and go read only once they fill it out.

Maybe images will help.

Before

Repeat appears

Once they hit the + Direction goes read only.

Hope that helps.

RyleeLam
New Contributor

Hi Doug, thank you! This is a nice little work around.Very useful.

0 Kudos
Jing_Sun
Esri Contributor

Hi Rylee,

Here’s a similar method that I would like to add to Doug’s solution.


Instead of making the top question ‘read-only’, we can take advantage of Repeat’s behaviour – it will ask to confirm before deleting the record.


This is what I do – this example survey only show user the repeat_1 section when the answer to Question 1 is ‘Yes’. User can always change their mind to select ‘No’ for Question 1 and answer the questions in another Repeat section related to ‘No’.


Step 1 – Survey opened.
Step 2 – Select ‘Yes’ for Question 1, the Repeat section appears.
Step 3 – Answer any question in the Repeat section then select ‘No’ for Question 1. The survey will ask to confirm before deleting the records.
However, this method has one tiny bug. In step 4 – after selecting ‘No’ for Question 1, if user change their mind and once again select ‘Yes’ for Question 1, the Repeat section related to ‘Yes’ does not appear. User will then need to select ‘No’ again then ‘Yes’ to enable the Repeat section. This scenario is rare unless users keep changing their mind. This bug has been submitted to Support.

Thanks to Gee Fernando for this method.

Cheers,
Sun