Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Works - Failed submission clears entered information #3978

Closed
dlim87 opened this issue Sep 12, 2019 · 13 comments
Closed

Works - Failed submission clears entered information #3978

dlim87 opened this issue Sep 12, 2019 · 13 comments
Assignees
Milestone

Comments

@dlim87
Copy link

dlim87 commented Sep 12, 2019

Descriptive summary

Submitting a work with an invalid field results in the work failing to be created (which is expected), and any fields you entered, or files you upload, are cleared.

Screen Recording 2019-09-12 at 01 56 PM

Tested on mac - Firefox Quantum 70.0b3

hyrax info Hyrax Version: 3.0.0.pre.rc1 Hyrax Branch: master Hyrax Revision: 48ed925

Nurax Version
ENV: production
SHA: 40b47b0d71af1b958e016ebe49212c1740683133
Branch: 2019-09-12-10-00
Updated: 12 Sep 2019 15:00:37

Rationale

It is not great to have to completely rebuild a work submission if a submission fails.

Expected behavior

The form data could be cached?

Actual behavior

Form data is lost if the submission doesn't go through

Steps to reproduce the behavior

  1. Log in
  2. Create a work
  3. Set an embargo or lease date to before today
  4. Press the save button

Related work

May be somewhat similar to #3414

@no-reply
Copy link
Contributor

@samvera/hyrax-repo-managers @samvera/hyrax-ui-ux-advisors i want to check in about this issue.

it seems clear to me that we should make the suggested improvement, so i've tagged this for the 3.x release series (effectively making it current work).

however, i think this is long standing behavior of the work form and, while unfortunate, isn't a release blocker.

thoughts?

@no-reply
Copy link
Contributor

discussion in slack seems to represent a consensus that this is not a release blocker.

i've marked it priority to reflect its status as a high value item for the 3.x release series.

@Dananji
Copy link
Contributor

Dananji commented Oct 11, 2019

Some work was done on the JavaScript side of the things to save the form data when POST request fails, and repopulate the form as it renders with the error alert. This adds a lot to maintaining the code in the future and seems like not the best way to do this. There should be much cleaner way to do this with forms in Ruby side of things. I'm not sure whether this is the same to the this question, but maybe this can be taken as an example of how to do this in server-side.

The current work done on this in the JS side is in the branch fix-issue-3978, which uses localStorage of the browser to retain form data. But the current work does not restore any files uploaded in the Files tab and users/groups added in the Sharing tab which are not previously saved.

@Dananji Dananji removed their assignment Oct 11, 2019
@blancoj blancoj self-assigned this Dec 4, 2019
@blancoj
Copy link
Contributor

blancoj commented Dec 4, 2019

@no-reply how about if we just don't let them pick a date that is invalid. This would be a simple/quick solution.

@no-reply
Copy link
Contributor

no-reply commented Dec 4, 2019

@blancoj this issue is broader than the date validation problem (which is represented by #3979).

the issue is that for any invalid form input, data isn't retained. since we do validation outside the form itself, we're always going to have cases where these kinds of problems could arise, right?

note that we closed #3979 as a browser issue, unrelated to hyrax work. i.e.: we already validate input dates at the form layer when the browser supports that using HTML5 features.

@blancoj blancoj removed their assignment Dec 5, 2019
@jeremyf jeremyf self-assigned this Sep 8, 2020
@jeremyf
Copy link
Contributor

jeremyf commented Sep 8, 2020

@no-reply - In my analysis of the situation, I'm thinking that I'd likely want to change the Hyrax::Forms::Workform behavior to use controller.params to set values.

def initialize(model, current_ability, controller)

What I'm thinking is that #new would call a newly defined set_attributes_from_parameters! method. That method would likely intersect controller.params keys with the terms/attributes for the form.

I'm writing this down to think through the approach, and to put a bookmark in it for today's work.

jeremyf added a commit that referenced this issue Sep 10, 2020
Prior to this commit, when I would submit an invalid work create form,
the re-rendered form would have blank input values.  With this change
all non-file attributes are re-loaded with the submitted values.

Please note, this needs a bit more time to put full polish on, but I
want to make sure its a path worth pursuing.  If this is a reasonable
path, I'm happy to add the additional specs and inline comments to get
this working.

I'm presently dissatisfied with the changes I needed to make to the case
statement, and would appreciate guidance on how to correct that.

Related to #3978
jeremyf added a commit that referenced this issue Sep 14, 2020
Prior to this commit, when I would submit an invalid work create form,
the re-rendered form would have blank input values.  With this change
all non-file attributes are re-loaded with the submitted values.

Please note, this needs a bit more time to put full polish on, but I
want to make sure its a path worth pursuing.  If this is a reasonable
path, I'm happy to add the additional specs and inline comments to get
this working.

I'm presently dissatisfied with the changes I needed to make to the case
statement, and would appreciate guidance on how to correct that.

Related to #3978
jeremyf added a commit that referenced this issue Sep 15, 2020
Prior to this commit, when I would submit an invalid work create form,
the re-rendered form would have blank input values.  With this change
all non-file attributes are re-loaded with the submitted values.

Please note, this needs a bit more time to put full polish on, but I
want to make sure its a path worth pursuing.  If this is a reasonable
path, I'm happy to add the additional specs and inline comments to get
this working.

I'm presently dissatisfied with the changes I needed to make to the case
statement, and would appreciate guidance on how to correct that.

Related to #3978
no-reply pushed a commit that referenced this issue Sep 17, 2020
Prior to this commit, when I would submit an invalid work create form,
the re-rendered form would have blank input values.  With this change
all non-file attributes are re-loaded with the submitted values.

Please note, this needs a bit more time to put full polish on, but I
want to make sure its a path worth pursuing.  If this is a reasonable
path, I'm happy to add the additional specs and inline comments to get
this working.

I'm presently dissatisfied with the changes I needed to make to the case
statement, and would appreciate guidance on how to correct that.

Related to #3978
@MariaStarPower
Copy link

Bug - When I go to create a new work, I am redirected to the Home page, instead of the work form.

Image 2020-10-08 at 1 06 46 PM Image 2020-10-08 at 1 07 28 PM

@jeremyf
Copy link
Contributor

jeremyf commented Oct 8, 2020

@MariaStarPower I'm moving this to the front of my queue.

@jlhardes
Copy link
Contributor

jlhardes commented Dec 8, 2020

Testing on nurax-dev using embargo date from past as invalid value - title, creator, rights statement, and alternative title (so required fields and non-required fields) are preserved in the form when the save fails.

@crisr15 crisr15 closed this as completed Dec 8, 2020
@rjkati
Copy link

rjkati commented Feb 23, 2021

Tested on nurax-dev in both Firefox and Chrome. Required fields and non-required fields are preserved, however file is removed. Is this expected? @jlhardes, let me know if this needs a new ticket.

@jlhardes
Copy link
Contributor

@rjkati I think this passes for what this issue was fixing (preserving the descriptive form field info on a failed submit). It is worth it to create a new ticket for the lost file upload, though, so we can see if anything can be done to preserve that as well. Link to this ticket for additional context.

@jeremyf
Copy link
Contributor

jeremyf commented Feb 25, 2021 via email

@rjkati
Copy link

rjkati commented Mar 25, 2021

Testing on iOS safari now displays an error page when setting a past embargo: https://nurax-dev.curationexperts.com/concern/generic_works?locale=en

Image from iOS

I've been able to reproduce this error on Windows Chrome, so it seems that it's not browser related. If I set a future date for the embargo, the deposit proceeds successfully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants