Custom Placeholder / Saving / reverting issues
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > Microsoft Content Management Server > Custom Placeholder / Saving / reverting issues




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Custom Placeholder / Saving / reverting issues  
Chris


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
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("&nbsp;", "").Length >
maxlength Then
errmsg = friendlyname & " exceeds maxlength (" & maxlength.ToString
& ")."
End If
End If

If _Required Then
If ThisPH.Datasource.RawContent.Replace("&nbsp;", "").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 ]



    Re: Custom Placeholder / Saving / reverting issues  
Stefan [MSFT]


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
08-25-04 12:00 AM

Hi Chris,

see here about usage of RawContent:
http://blogs.msdn.com/stefan_gossne.../24/119546.aspx

Cheers,
Stefan.

--
This posting is provided "AS IS" with no warranties, and confers no rights.

MCMS FAQ:
http://download.microsoft.com/downl...>
MCMS+2002+-+(complete)+FAQ.htm
MCMS Blog: http://blogs.msdn.com/stefan_gossner/category/4983.aspx
MCMS Sample Code:
http://www.gotdotnet.com/community/...nagement+Server
MCMS Whitepapers and other docs:
http://blogs.msdn.com/stefan_gossne...2/07/41859.aspx
--------------------------------


"Chris" <cbarr42k@yahoo.com> wrote in message
news:cgg1gl$5q2@odbk17.prod.google.com...
> 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("&nbsp;", "").Length >
> maxlength Then
> errmsg = friendlyname & " exceeds maxlength (" & maxlength.ToString
> & ")."
> End If
> End If
>
> If _Required Then
> If ThisPH.Datasource.RawContent.Replace("&nbsp;", "").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 ]



    Re: Custom Placeholder / Saving / reverting issues  
Chris


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
08-25-04 12:00 AM

Hm.. OK I read this and it makes sense so I changed my code... But, for
my main question, how would I go about setting the HTML/TEXT property
back to what it was the user typed in instead of reverting back to the
last saved version? IE.

Text original state before edit: Test String
Text after edit: Test String to break

After clicking save... the webauthorcontext is going to raiseerrorevent
because the length of the typed in string is greated than I am allowing
in my custom property.. So at this point, how would I keep the
placeholder text to be what the user just typed in, instead of it
reverting back to the original "Test String"






[ Post a follow-up to this message ]



    Re: Custom Placeholder / Saving / reverting issues  
Stefan [MSFT]


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
08-25-04 12:00 AM

Hi Chris,

this content needs to be in a Request.Form variable.
Pick it up there.

Cheers,
Stefan.

--
This posting is provided "AS IS" with no warranties, and confers no rights.

MCMS FAQ:
http://download.microsoft.com/downl...>
MCMS+2002+-+(complete)+FAQ.htm
MCMS Blog: http://blogs.msdn.com/stefan_gossner/category/4983.aspx
MCMS Sample Code:
http://www.gotdotnet.com/community/...nagement+Server
MCMS Whitepapers and other docs:
http://blogs.msdn.com/stefan_gossne...2/07/41859.aspx
--------------------------------


"Chris" <cbarr42k@yahoo.com> wrote in message
news:cgg3bn$rr4@odah37.prod.google.com...
> Hm.. OK I read this and it makes sense so I changed my code... But, for
> my main question, how would I go about setting the HTML/TEXT property
> back to what it was the user typed in instead of reverting back to the
> last saved version? IE.
>
> Text original state before edit: Test String
> Text after edit: Test String to break
>
> After clicking save... the webauthorcontext is going to raiseerrorevent
> because the length of the typed in string is greated than I am allowing
> in my custom property.. So at this point, how would I keep the
> placeholder text to be what the user just typed in, instead of it
> reverting back to the original "Test String"
>







[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 09:32 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register