umco / umbraco-inner-content

A helper library for Umbraco Doc Type based property editors providing overlays and conversion helpers
https://our.umbraco.org/projects/backoffice-extensions/inner-content/
MIT License
2 stars 15 forks source link

Validation on mandatory fields #21

Open leekelleher opened 6 years ago

leekelleher commented 6 years ago

Let's explore if we can have cursory validation on mandatory fields within Inner Content.

This would only be for client-side validation - server-side would open a can-of-worms!

leekelleher commented 6 years ago

@mattbrailsford I've spent a few hours investigating how this would work, but I can't figure out how to trigger the validation on the submit event. Any ideas would be appreciated - no rush though.

markadrake commented 6 years ago

Hi @leekelleher and @mattbrailsford - any progress on adding validation to inner content? Or any knowledge you have to share about how Umbraco's default editor validates the models? All the best!

leekelleher commented 6 years ago

@markadrake In all honestly, I wasn't able to figure out how to do it. I couldn't see where Umbraco was triggering the client-side validation - which I wanted to trigger when the overlay panel was closed (or the "Done" button was pressed).

At this point, I'm open to any suggestions! 😃

markadrake commented 6 years ago

@leekelleher is it me or has something changed in Umbraco v7.12.3?

image

image

Just a quick test tonight. But above I set a textbox to required and it validated all by itself.

Looks like the media picker doesn't have client-side validation (it doesn't as a regular content node either this actually validates on the POST).

I could have sworn just days ago this didn't work.

leekelleher commented 6 years ago

Interesting! I'm pretty sure that this didn't work previously too.

I'm hoping to get chance to look at this again, at this weekend's CodeCabin!

markadrake commented 6 years ago

In the meantime, I'm going to open up a discussion on the forums about adding client side validation to the media picker. But my first couple of tests looks like something's been released to run validation automatically. High five! haha