Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Client Side Validation Goofing up Web Part Page Design Mode.

  Asked By: Dontae    Date: Aug 24    Category: Sharepoint    Views: 2021

I have client side validation code that I'd like to ignore when a web
part page is in 'design' mode. The validation is failing (unless I
properly fill in the fields) and is, therefore, causing me to be
unable to follow links and click buttons on the toolpanes.

I have looked for some JavaScript object is made available when web
part pages are rendered that I can query to conditionally ignore
validation, but I cannot find one. Of course, I would like a similar
mechanism on the server side to help with this.



1 Answer Found

Answer #1    Answered By: M Juarez     Answered On: Aug 24

As it turns out, there is a hidden input field put into the page
called 'MSOLayout_InDesignMode'. Apparently it's always accessible.

I have created a JavaScript function and a VB.Net function to let me
know if the page  is currently in Design Mode.

function IsWSSDesignMode()
if (document.all('MSOLayout_InDesignMode'))
return document.all
return false;

VB.Net Function for Server side  processing:
Public Function IsWSSDesignMode() As Boolean
Return CBool(Len(Request.Form("MSOLayout_InDesignMode")))
End Function

All I did was add a line similar to the following as the first line
in my client  side validator and a similar one in my server  side
custom validators.

if (IsWSSDesignMode()) return;