omeka-s
omeka-s copied to clipboard
Resource template required fields
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.
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.
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.
Edited the class to be more specific to the input. It's ready to test @allanaaa
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:
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.
You should now only get one label, @allanaaa
No luck on this yet, sorry.
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.
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.
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.
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.
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: