08-25-04 12:00 AM
Stefan, thanks for your reply yesterday... I tooka different approach
and was wondering if someone could help me with this....
I created a customer placeholder control with two properties (maxlength
(int) and required (bool)). Basically, when the author tries to save
the posting, the placeholder control will check itself to see if the
text is within the constraints... if not, i display an error.. when you
raise an ErrorModeContainer.FailedSavePlaceholder it reverts the text
the user typed back to the last 'valid' version.. I'd rather have what
they typed in the control still be display for them to go back and edit
to the correct length.. here is my custom class save method...
Protected Overrides Sub SavePlaceholderContent(ByVal e As
Microsoft.ContentManagement.WebControls.PlaceholderControlSaveEventArgs)
MyBase.SavePlaceholderContent(e)
Dim errmsg As String = ""
Dim ThisPH As
Microsoft.ContentManagement.Publishing.Extensions.Placeholders.HtmlPlacehold
er
= MyBase.BoundPlaceholder
If maxlength <> -1 Then
If ThisPH.Datasource.RawContent.Replace(" ", "").Length >
maxlength Then
errmsg = friendlyname & " exceeds maxlength (" & maxlength.ToString
& ")."
End If
End If
If _Required Then
If ThisPH.Datasource.RawContent.Replace(" ", "").Length = 0
Then
errmsg = "Content is required for " & friendlyname
End If
End If
If errmsg.Length > 0 Then
Dim err As New
Microsoft.ContentManagement.WebControls.WebAuthorErrorEventArgs(ErrorModeCon
tainer.FailedSavePlaceholder,
New Exception(errmsg))
Microsoft.ContentManagement.WebControls.WebAuthorContext.Current.RaiseErrorE
vent(err)
' right here is where i'd like to set the
rawcontent back to what the user typed in if possible?
End If
End Sub
[ Post a follow-up to this message ]
|