umbraco / Umbraco-CMS

Umbraco is a free and open source .NET content management system helping you deliver delightful digital experiences.
https://umbraco.com
MIT License
4.4k stars 2.66k forks source link

Email address property editor validation doesn't block post back when invalid email address is provided #9761

Open EneldoDev opened 3 years ago

EneldoDev commented 3 years ago

When editing content node with property using Email address property editor, frontend email validation doesn't block postback when email is provided in wrong format.

Umbraco version

I am seeing this issue on Umbraco version: 8.11.0

Reproduction

Steps to reproduce

  1. Create document type with property using Email Address property editor (field NOT mandatory).
  2. Using this document type create content node. Fill email address field with improper value.
  3. Save/Save and publish content.

Expected result

Invalid email error message is shown and postback on save is blocked. No page reload.

Actual result

Once Save/Save and publish button is clicked validation message "Invalid email" is shown but form postback isn't blocked. Content node is saved, page reloaded. Email address field is empty though what means backend validation works correctly.

Validation is working properly only when "Field is mandatory" checkbox is checked.

emma-hq commented 3 years ago

Hey @EneldoDev

Thanks for reporting this. I'll try to reproduce and let you know how we'll progress once I have :)

Emma

emma-hq commented 3 years ago

Hey @EneldoDev

Yep - I have exactly this problem on both 8.11.0 and later releases. We'll label this up for grabs so someone can fix it 😁 Of course, you're very welcome to submit a pr if you have the inclination.

emailvalidation

Emma

umbrabot commented 3 years ago

Hi @EneldoDev,

We're writing to let you know that we would love some help with this issue. We feel that this issue is ideal to flag for a community member to work on it. Once flagged here, folk looking for issues to work on will know to look at yours. Of course, please feel free work on this yourself ;-). If there are any changes to this status, we'll be sure to let you know.

For more information about issues and states, have a look at this blog post

Thanks muchly, from your friendly Umbraco GitHub bot :-)

emma-hq commented 3 years ago

For the person picking up this issue - please also look at #9727 The numeric prop editor exhibits the same behaviour

Emma

bjarnef commented 3 years ago

Not specific fixing this issue, but related to the integer/numeric datatype validation if a step size has been set: https://github.com/umbraco/Umbraco-CMS/pull/10039

bjarnef commented 3 years ago

@Shazwazza maybe you have an idea why an invalid value doesn't prevent the form from being submitted. In case the format is invalid the value isn't saved though, but I would expect an notification error and/or highlight of the invalid property. Nore sure if the worked previous if the value was invalid and the property wasn't mandatory.

bowserm commented 2 years ago

I stumbled upon this as well in v9.0.1 and v9.2.0. It looks like the Mandatory Validation will prevent both save and publish when the data is missing, but the Custom Validation by regex will allow the data to be saved but not published. The behavior of the two types of validation are inconsistent. Both display all the right messages to the content editor, but that almost makes it even more confusing when they don't behave consistently.

See my closed todo here for how I described the problem: https://github.com/umbraco/Umbraco-CMS/issues/11884

I closed out my issue already because I realized after creating it that it was a duplicate of this issue.

eden-jh commented 2 years ago

I missed a bunch of recent comments, I'm checking to see to what extent this is still an issue and if there's anything left that needs to be fixed.

There was an intentional change to allow invalid content to be saved but not published, so users could save progress with validation errors: https://github.com/umbraco/Umbraco-CMS/pull/9691 so it seems like the bug is just that validation errors don't prevent publishing, not that they don't prevent saving.

eden-jh commented 2 years ago

Going to take a stab at fixing this. It looks like there's still an issue at least with inline block lists. For whatever reason, maybe because there's an update missing, my local version of Umbraco-CMS will catch maxChars errors on a textbox if the parent block is open, but not when it's closed. And my version for another project won't catch it even when it's open, unless there's also a server-side error present.

Zeegaan commented 1 year ago

Jumping in here to say that this is still an issue in later versions too, I can reproduce this on V10 😁 A good point here is brought up by @eden-jh that there was an intentional change to allow invalid content to be saved, so I will pass this by the front-end team for a decision on how we should go about this issue.

Zeegaan commented 1 year ago

Alright following up here: so you should still be able to save (even with an invalid email) but it should not delete the value you put in there, nor should you be able to publish with an invalid value 👍

henryson commented 5 months ago

Still not fixed in v13? Seems to affect all property validation?