Still relatively new to Umbraco but having fun so far!
Having an issue when attempting to implement some custom validation into the membership section. I have created a method for Member.BeforeSave and have determined it successfully gets called by placing a log call in there.
The problem I am having however is that when I set the action to cancel it saves regardless. Even when including a call for an error speech bubble it simply shows the 'Member saved' bubble again.
I have used the exact same code for Document.BeforeSave and it works perfectly. No saving. My custom speech bubble shows.
Code below.
Many thanks. J.
public class MemberValidation : ApplicationBase
{
public MemberValidation()
{
Member.BeforeSave += new Member.SaveEventHandler(Member_BeforeSave);
}
void Member_BeforeSave(Member sender, SaveEventArgs e)
{
((BasePage)HttpContext.Current.Handler).ClientTools.ShowSpeechBubble(BasePage.speechBubbleIcon.error, "Manual override", "This node was not saved, deal with it!");
e.Cancel = true;
}
}
public class NodeValidation : ApplicationBase
{
public NodeValidation()
{
Document.BeforeSave += new Document.SaveEventHandler(Document_BeforeSave);
}
void Document_BeforeSave(Document sender, SaveEventArgs e)
{
((BasePage)HttpContext.Current.Handler).ClientTools.ShowSpeechBubble(BasePage.speechBubbleIcon.error, "Manual override", "This node was not saved, deal with it!");
e.Cancel = true;
}
}
:) Read this one too, it does look that way, I've a workaround for it so it's no biggie but thought it was about time I made some presence on the forums, thanks for your replies.
I was starting to get into the bad habit of contacting Lee [Kelleher] directly as we're friends from our previous job.
Member.BeforeSave cancel argument not working
Hello all.
Still relatively new to Umbraco but having fun so far!
Having an issue when attempting to implement some custom validation into the membership section. I have created a method for Member.BeforeSave and have determined it successfully gets called by placing a log call in there.
The problem I am having however is that when I set the action to cancel it saves regardless. Even when including a call for an error speech bubble it simply shows the 'Member saved' bubble again.
I have used the exact same code for Document.BeforeSave and it works perfectly. No saving. My custom speech bubble shows.
Code below.
Many thanks.
J.
Did you update a property of the member? Member and document properties are saved when you set them. Check out this blogpost what describes that.
Cheers,
Richard
I did come across that after I posted however the change I made was through the Umbraco GUI, I imagine that may not make a difference though.
There was an Improvement on V4.5.x that fixes this behaviour for Document types, apparently not for Members.
Cheers,
Richard
:) Read this one too, it does look that way, I've a workaround for it so it's no biggie but thought it was about time I made some presence on the forums, thanks for your replies.
I was starting to get into the bad habit of contacting Lee [Kelleher] directly as we're friends from our previous job.
Nice that you have a work around and its always better to use the forum so people can search for potential answers (and Lee gets some work done ;-) ).
Cheers,
Richard
Well I say habit, it's been twice now but I keep having to say to myself 'Forum first, is what it is there for' as I'm picturing emailing him :P
Yeah if i needed to capture if I'd create my own Member provider and then run a custom eventing model.
Thanks guys
is working on a reply...