Clear a field when another file has been uploaded in edited submission

  • mathmods
    Asked on August 7, 2015 at 7:41 PM

    Is it possible to clear a field when a user updates a file he'd previously uploaded?

    I have a form where users are asked to submit a few files. An admin gets notification via email and then connects to write a comment (into a readonly text box) from the Edit function in the Submission section (admin area).

    The problem is: when the user edits his file, the previous negative comment (e.g. not good, please edit this file) is still there until the admin logs in to change it. That's why I'm looking for a way to have such comment (the one in the readonly text box) cleared when a new file is uploaded (or after submission, that's just as well). Thanks

    Or, better still, if you have a completely different way to implement all of this, you're more than welcome!

  • Boris
    Replied on August 8, 2015 at 2:54 AM

    I have looked into this issue, and it seems that there is no real way to detect if they have uploaded a different file - much due to security restrictions implemented in JavaScript, which is what our conditions are written in.

    Existing mechanisms inside the form can only detect if a file name has been changed, but not if a file itself has been changed. As your form is asking for a list, it is very likely that most of your users will simply edit their file on their computer and upload this updated file (which means it has the same name).

    A bit clunky way could be implemented - to allow your users to delete your (admin) comment when they are editing a submission. You would need to add a Radio Button field for every one of your upload fields.

    Clear a field when another file has been uploaded in edited submission Image 1 Screenshot 40

    Then, we set up two conditions for this Radio Button field.

    1. If the admin's comment field is filled, AND if it is not filled with just a single blank space, Show this Radio Button. So it will not be visible unless the admin has entered his comment.

    Clear a field when another file has been uploaded in edited submission Image 2 Screenshot 51

    2. If the Radio Button is set to Yes, Update the admin comment field with a single space (we can't update it with an empty value, unfortunately).

    Clear a field when another file has been uploaded in edited submission Image 3 Screenshot 62

    This would allow the user to clear your comment when they are editing their submission. I hope this helps.

  • mathmods
    Replied on August 8, 2015 at 3:25 AM

    That sounds like a great workaround, thanks!

  • mathmods
    Replied on August 8, 2015 at 5:34 AM

    I've just found out that, when I enter the "Submissions" section to add my comments (into the readonly boxes), the radio button questions (Yes, it's been addressed, no, not yet...) are already there. Can you think of any way to hide them from there? I mean, I'm the admin myself, I know that all I have to do is answer "no" to all of them before submitting, but if I forget to tick "No" and I tick "Yes", my comment gets cleared. It'd be better if such questions were not shown there at all, at least before the first comment has been entered.

    But I can't think of a way to show them to front-end users only... I tried to a radio button question (hidden to front-end users): "Are you an admin?". If you answer yes, those questions are hidden. But then, when I enter my submissions, and I reply "Yes" to such questions and save my comments, that question (are you an admin) is saved as "yes" for front-end users, too. So, when users edit their submission later on, they won't see the radio-type questions you suggested (Has this been addressed?).

  • Boris
    Replied on August 8, 2015 at 11:59 AM

    As an admin, it seems that you can only deliberately ignore these radio button fields and not enter anything into them.

    I have looked into achieving your desired workflow on my cloned version of your form, and I have not been unable to get a fully and predictably working automatic solution for hiding these Radio Buttons on your submission edit panel. I tried enabling the Clear Hidden Field Values and setting it to Clear On Being Hidden, while using conditions to Show/hide fields and clear the admin comments that way.

    Clear a field when another file has been uploaded in edited submission Image 1 Screenshot 40

    Clear a field when another file has been uploaded in edited submission Image 2 Screenshot 51

    Still, the Radio Buttons were showing in the Submissions page for you/me as an admin.

    Clear a field when another file has been uploaded in edited submission Image 3 Screenshot 62

    I have also tried using our Get Referrer widget in addition to the already implemented conditions, though the Get Referrer widget captures only the URL that was used to make that submission - not your current URL / referrer. In other words, it can't detect your used URL until the form is submitted, so it doesn't see if you are on the /submissions/ page.

    Based on the testing performed, I would advise you to please try and see if simply ignoring these Radio Buttons on the Submission Edit panel will work in your case. I will try end spend some more time on this later, to see if I can come up with another approach to having these fields not show for you on the Submissions page while editing, and still show for the user when they user their regular Edit Link.

    I hope this helps.