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

Premature validation of dataset metadata (single value drop down) prevents template selection #10119

Closed
jo-pol opened this issue Nov 13, 2023 · 8 comments
Labels
Type: Bug a defect
Milestone

Comments

@jo-pol
Copy link
Contributor

jo-pol commented Nov 13, 2023

What steps does it take to reproduce the issue?

Preparations (while logged in on on https://demo.dataverse.org ):

  • create a new dataverse, under metadatafields
    • deselect “Use metadata fields from Demo Dataverse“
    • select “Journal metadata“ and make “type of article required“
  • Create a new template in the new dataverse with some value in the title of the citation metadatablock of the template

Scenario 1a

  • in the new dataverse, under "add data" select "new dataset"
  • don't fill in any fields
  • save the dataset

Scenario 1b (follow up of 1a)

  • fix the "type of article"
  • save again

Scenario 2a

  • in the new dataverse, under "add data" select "new dataset"
  • don't fill in any fields
  • select the template

Scenario 2b (follow up of 2a)

  • fix the "type of article"
  • select the tamplate

When does this issue occur?

See preparations above

Which page(s) does it occurs on?

See scenario's above

What happens?

Scenario 1a/2a: The page scrolls down with the screenshot just out of sight.

Scenario 1b: The page scrolls back to the top with a red error message "...required fields were missed..."

Scenario 2b: The page scrolls back to the top and the title form the template is filled in.

While debuging, I also noticed a lot of server side validation occurred when selecting "new dataset" under "add data". Though it does not cause error messages for the end user, it does not make sense to me. Similarly, I don't expect any validation when selecting a new template as all data is cleared and replaced anyway.

To whom does it occur (all users, curators, superusers)?

Depositors

What did you expect to happen?

Scenario 1a: as scenario 1b including a red message "Type of Article is required", not just the button highlighted in red what is easily overlooked.

Scenario 2a: the title of the template is filled in for the new dataset

Which version of Dataverse are you using?

v. 6.0 build 1512-366fd41

Any related open or closed issues to this bug report?

#2190 The premature validation causes scrolling to the missing required filed, but just too little.

Screenshots:

image

@jo-pol
Copy link
Contributor Author

jo-pol commented Nov 14, 2023

I tried a hack on a DANS development environment and changed the required attribute to false in the deployed metadataFragment.xhtml and rebooted the server. To my surprise the red required mark still showed up and at first sight it caused the desired behavior in both scenarios. I did not yet check whether this has undesired effects in other situations.

<p:selectOneMenu value="#{dsf.singleControlledVocabularyValue}" converter="controlledVocabularyValueConverter" style="width: auto !important; max-width:100%; min-width:200px;" styleClass="form-control primitive"
id="unique1" required="#{dsf.required and datasetPage}" rendered="#{!dsf.datasetFieldType.allowMultiples}" filter="#{(dsf.datasetFieldType.controlledVocabularyValues.size() lt 10) ? 'false':'true'}" filterMatchMode="contains">

@qqmyers
Copy link
Member

qqmyers commented Nov 16, 2023

A clearer test case: as in scenario 1, have a required field in another metadatablock (e.g. type of article) and a template that should set a field(s) in the citation block (e.g. title). When you create a new dataset and select the template, the page updates but the template fields are not filled in (e.g. no title appears). The page also scrolls down to the missing required field in the other block and the page is left showing that the template is in use when it has not been applied.

@jo-pol
Copy link
Contributor Author

jo-pol commented Nov 17, 2023

A sharp observation that I overlooked: the page is left showing that the template is in use when it has not been applied.

Scenario one is our blocking problem. Scenario two helped me to realize there are two phases of validation. One phase controlled by the HTML attribute required, another phase controlled by the tsv's/db-table datasetfieldtype.

@jggautier
Copy link
Contributor

Hi @jo-pol. I've been following this issue because I noticed part of what you've written and what your screenshot shows, that when someone tries to save a dataset where they haven't filled in a required "single value dropdown" field, the validation error is only that the dropdown button is highlighted in red, "which is easily overlooked" and doesn't match the error messages that Dataverse shows for other types of fields that have some sort of validation. It's an error that some users of Harvard Dataverse will see since the repository is adding a required "single value dropdown" field (IQSS/dataverse.harvard.edu#232).

Will your PRs address this, too? Or should another GitHub issue be opened about making it easier for users to see when they need to choose an option from a "single value dropdown" field in order to save the dataset?

@jo-pol
Copy link
Contributor Author

jo-pol commented Sep 23, 2024

fixed by caf2d91 on the following branches
iqss/beta-deploy
iqss/develop
iqss/master

@jo-pol jo-pol closed this as completed Sep 23, 2024
@pdurbin
Copy link
Member

pdurbin commented Sep 25, 2024

It looks like automation closed this but I'm reopening it until this PR is merged (which will auto-close it):

@pdurbin pdurbin reopened this Sep 25, 2024
@qqmyers
Copy link
Member

qqmyers commented Sep 26, 2024

@jo-pol - thanks for verifying that this has been fixed. Closing.

@qqmyers qqmyers closed this as completed Sep 26, 2024
@pdurbin
Copy link
Member

pdurbin commented Sep 26, 2024

I see. It was fixed in 6.2 by this commit: caf2d91

I guess I'll add the 6.2 milestone.

@pdurbin pdurbin added this to the 6.2 milestone Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug a defect
Projects
None yet
4 participants