Validating User Submission

502
3
Jump to solution
10-07-2021 01:30 PM
MayaVelasco1
New Contributor II

I'm creating a survey where volunteers will be used to collect data. The data will be open to the public, but we want to make sure that only trained volunteers can submit the survey. I found other examples of how this is possible using the pulldata() function. I was wondering if someone had an xlsx example since I'm a little unsure of setting this up? 

I'm attaching my xlxs. The password question is the first question (row 10). I don't want the form to pull the value from the csv, but want to check what the user input as the same as the csv. 

Also will it be possible to change the "password" after some time or will that create an issue when trying to update the survey? Could you simply change the word in the csv in order to change the password? 

0 Kudos
1 Solution

Accepted Solutions
DeonLengton
Esri Contributor

Hi Maya

> I don't want the form to pull the value from the csv, but want to check what the user input as the same as the csv. 

I am not sure what you mean with this statement but since you will only have one password at any one time for your survey I think its a bit of an overkill to use a CSV file.

If you only have one password then you might as well hardcode the password into your survey and republish it whenever you want to change the password. You can then enable "Require update to the latest version of this survey" to enforce the user to update the survey to reflect the new password.

If you really want to use a CSV file to store your password then you can verify the entered password in your survey with the following pulldata function into a calculate field named password_onfile:

pulldata('loginfile','password','password', ${Password})

where:

  • loginfile is your CSV filename without the extension placed in the media folder
  • password is the only heading in your CSV file
  • ${Password} is the field in your survey where the user types the password 

You can then simply check if the pulldata() calculation matches the entered Password:

${Password}=${password_onfile}

I would propose that you create a link to a hosted CSV file to make the process a bit more automated. If you update the hosted CSV file it will automatically be downloaded to your survey whenever it changes.

I attached a working example for your convenience.

View solution in original post

3 Replies
DeonLengton
Esri Contributor

Hi Maya

> I don't want the form to pull the value from the csv, but want to check what the user input as the same as the csv. 

I am not sure what you mean with this statement but since you will only have one password at any one time for your survey I think its a bit of an overkill to use a CSV file.

If you only have one password then you might as well hardcode the password into your survey and republish it whenever you want to change the password. You can then enable "Require update to the latest version of this survey" to enforce the user to update the survey to reflect the new password.

If you really want to use a CSV file to store your password then you can verify the entered password in your survey with the following pulldata function into a calculate field named password_onfile:

pulldata('loginfile','password','password', ${Password})

where:

  • loginfile is your CSV filename without the extension placed in the media folder
  • password is the only heading in your CSV file
  • ${Password} is the field in your survey where the user types the password 

You can then simply check if the pulldata() calculation matches the entered Password:

${Password}=${password_onfile}

I would propose that you create a link to a hosted CSV file to make the process a bit more automated. If you update the hosted CSV file it will automatically be downloaded to your survey whenever it changes.

I attached a working example for your convenience.

MayaVelasco1
New Contributor II

Thank you Deon! I was worried I wouldn't be able to change the password since sometimes if I make changes to surveys I can't republish without overwriting the data that is submitted. Do you know if this would be the case if I want to change the password in the future. 

I think it is overkill to add a csv then. To hardwire the question, would I write it in the constrain column? I'm sure its simple, but I'm not sure how I would do that. 

0 Kudos
MayaVelasco1
New Contributor II

 I see your excel sheet now, thank you for those. I will try out these solutions. I just want to make sure that I can change passwords in the future without any issues with overwriting the data. 

0 Kudos