omeka-s icon indicating copy to clipboard operation
omeka-s copied to clipboard

Resource template required fields

Open allanaaa opened this issue 1 year ago • 10 comments

I have a resource template with several required fields. When I apply the template to an existing item, then try to save, I get an error about the first required field that stops me from moving on. I don't get an error about the other field(s), in this case the creator field. When I put in a description and save, it will save the new description value, give me an error about the creator, and fail to save the template change.

template-required template-required2

What I'd like instead is for the creator (and any other required fields) error to work the same way as the description error does, and stop me from moving on until I fill everything out. I presume this is "We only show one error, the first we come across, and then don't do any more checks after that" rather than "We only check a few particular properties when they are required", which would be odd.

allanaaa avatar Mar 27 '23 15:03 allanaaa

This is due to an errant "value" class in the URI data type's markup (here). We need to remove the class, but it affects the styling.

@kimisgold Would you take a look at this? We need to replace that "value" class.

jimsafley avatar Mar 27 '23 16:03 jimsafley

Edited the class to be more specific to the input. It's ready to test @allanaaa

kimisgold avatar Mar 27 '23 20:03 kimisgold

It's giving an error for all required fields now. But it's pulling both the original field name and the alternate titles in an unwieldy way:

creatorauthor

allanaaa avatar Mar 28 '23 15:03 allanaaa

The code attempts to do what I think is expected here: it just uses the label. The problem is that the non-custom label is there in the markup, hidden, so the code here is finding both the original and the alternate label. Something simple like calling .last() before getting the text may be sufficient.

zerocrates avatar Mar 28 '23 21:03 zerocrates

You should now only get one label, @allanaaa

jimsafley avatar Mar 28 '23 21:03 jimsafley

No luck on this yet, sorry.

restemp

allanaaa avatar Apr 04 '23 17:04 allanaaa

Just to make sure, do the whole "clear cache" thing: this was a Javascript-only fix so if you're looking at the old Javascript you'd still see it.

zerocrates avatar Apr 04 '23 17:04 zerocrates

Ah, yep, that worked.

Meanwhile, some of the required fields are still not being caught. It seems to be related to whether they have an assigned data type. Note "Date" not being caught in one example, and "Language" not being caught in the other. date restemp2

allanaaa avatar Apr 04 '23 17:04 allanaaa

The basic deal is, value markup needs to have a to-require class on whatever needs to be filled in for the value to be considered complete. Probably for these ones that aren't triggering, they don't have a to-require on anything. If nothing in the value form is to-require then it's always considered "completed."

Both are a little oddball in that they involve having several inputs each of which is optional. ValueSuggest may be able to get by marking the main visible input as to-require but I suspect something more complex may be required for NumericDataTypes (or maybe just requiring the "first" input will be sufficient there).

This would be an issue for each module, anyway.

zerocrates avatar Apr 06 '23 18:04 zerocrates

Yep, it's fields with Value Suggest or some other data type assigned that don't always (but sometimes do) catch an error before you save. Instead you see this after saving.

required

This means that, if you enter in information elsewhere (like adding map markers on the Map tab), you'll lose that work when you save the item.

It looks like it'll report the first one it comes across each time, instead of all the ones that need to be fixed: one-error

allanaaa avatar Jun 12 '23 21:06 allanaaa