KOBENDigital / ConditionalDisplayers

Collection of modified Umbraco property editors to make them able to control the display of other properties in the same document type.
9 stars 14 forks source link

Ignore required state for hidden fields #9

Closed levipadre closed 4 years ago

levipadre commented 4 years ago

Hi,

Is it possible somehow to ignore required fields? When I hide a few fields "under" the conditional switcher and they are required, I can't save the page. It would be great if the active "visible" state can control the fields under it.

skartknet commented 4 years ago

Yes, that'd be good. That's not supported. I'll keep this ticket open so I don't forget to take a look.

levipadre commented 4 years ago

Do you think this required field support will happen any time soon? It would be really useful in my project. I don't think I can find similar package at all.

skartknet commented 4 years ago

Sorry but my free time is not too much. I'll do my best to have a solution soon but you should probably think of other alternatives. Is it that important that those fields are mandatory? I mean they will offer a better user experience but you probably go ahead without them being mandatory.

levipadre commented 4 years ago

Yeah, I totally understand it. No other alternative unfortunately, but maybe the required fields won't be a big problem. If you don't have enough time, I assume it wouldn't help if I compensate your time a bit. If do so, please let me know.

skartknet commented 4 years ago

I have tried today and I managed to toggle the validation in the frontend but 'unfortunately' Umbraco validates the model before saving so it returns an error. So I'm afraid to say that at this point that's not going to work.

levipadre commented 4 years ago

Thank you for your time and effort, it’s very kind of you.

Btw, isn’t it possible by adding disabled attribute to the fields temporarily which are required? As I know the form shouldn’t send disabled fields to server.

I’ve also read something about a no-dirty-check attribute here: https://our.umbraco.com/forum/using-umbraco-and-getting-started/89316-you-have-unsaved-changes-in-custom-dashboard , but maybe it’s a different case.

skartknet commented 4 years ago

Yes, but that disables the frontend validation. The issue now lies in that the server is also validating the form, it uses the doctype values to do so and if a value is mandatory it will return an error.