0

We have a set of sitecollection, with around 30 lists, where the forms do not appear as modal windows.

Everyone of those now needs a new webpart added. Adding the webpart itself works. When I edit the newly added webpart and hit "Apply" or "OK" the validation kicks in and prevents the postback from happening.

The only way to apply the configuation changes to the webpart is to fill in a character in each required field (valid or not doesn't matter).

Is there a way to prevent this behaviour from happening or temporarily disable the validation while editing the page?

Edit: This is based on Sharepoint 2010

1

You may use below javascript to handle this scenario:

var inDesignMode = document.forms[MSOWebPartPageFormName].MSOLayout_InDesignMode.value;
/*(inDesignMode === "1") means Edit Mode; "0" DisplayMode */
if (inDesignMode === "1") {
    for (var i = 0; i < Page_Validators.length; i++) {
        ValidatorEnable(Page_Validators[i], false);
    }
}

  • Thanks, this did the trick - however, you need to check for =="1", not the negation for it, if you want to disable the validation in edit mode. – Marco Feb 4 '16 at 12:33
  • great that helped, answer updated for correction! – Ovais Khatri Feb 5 '16 at 6:25
0

If all instances of the Web Part have the same properties, maybe you can try to:

  1. Do the job once (i.e. add the Web Part, edit its properties, fill form required properties, apply).
  2. Export the Web Part from the Web Part's top-right menu
  3. Save the exported file (XML file with extension .dwp or .webpart)
  4. On every other pages, instead of adding a Web Part from the catalog, upload the .dwp/.webpart file (choose "Add a Web Part", and then "Upload a Web Part" right above the categories list in the top panel).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.