I used the below line to check
(window.location.href.toLowerCase().indexOf("mode=1")>0)?NWF$("input.user").val():NWF$("div.user").text()
mode=1 is for edit mode and mode=2 is for display mode
I can confirm that this method works. (Nintex 2016 / SharePoint 2016 On-Premises)
NWF.FormFiller.Events.RegisterAfterReady(function () {
if ({Common:IsNewMode}) {
alert('New Mode');
}
});
Thanks for this confirmation
One caveat: if you are not embedding custom JS but instead linking to a JS file on the server in your form's Custom JavaScript Includes, then these functions will not work automatically. I am assuming that the ({Common:______}) reference is translated into a real function by something in the NWF library, but it's not obvious what would do this.
Thanks for the details
Hi there,
I get an erorr while debugging JS:
SCRIPT5009: 'IsNewMode' is undefined
The start of the JS is simple:
NWF$(document).ready(function () { if ({Common:IsNewMode}) { GetUser(); } ...
How come?!
Nintex F. 2013 (Version: 2.11.3.10)
You can detect the form mode in JavaScript using the following syntax:
':IsNewMode' ':IsEditMode' ':IsDisplayMode'
For example:
if ':IsNewMode' {
alert('Form is in New mode');
} if ':IsEditMode' {
alert('Form is in Edit mode');
}
if ':IsDisplayMode' {
alert('Form is in Display mode');
}
You can always use
var isNewMode = window.location.pathname.indexOf('NewForm.aspx') > -1;
var isDisplayMode = window.location.pathname.indexOf('DisplayForm.aspx') > -1;
var isEditMode = window.location.pathname.indexOf('EditForm.aspx') > -1;
Or use
if(window.location.pathname.indexOf('mode=1') > -1) {
// edit mode
}
in Nintex Forms for Office 365
Where mode=1 is Edit-Mode and mode=2 is Display-Mode