I'm customizing the DisplayForm
of a list, and I want put a button on footer to EditForm
, but in the ctx
has no edit form url and no CurrentItem.ID
.
How can I do this?
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It only takes a minute to sign up.
Sign up to join this communityGetting from ctx
var itemId = ctx.FormContext.itemAttributes.Id;
I have executed above code under OnPreRender
& OnPostRender
both. So you can use it where you need it.
I think it is easier to get from Query String rather than from ctx.FormContext
.
As per Asad's comment, Getting from Query String
var itemId = GetUrlKeyValue('ID');
Have a look on this answer by Danny Engelman to read more about Query String.
ctx.FormContext.itemAttributes.Id
?
Nov 24, 2015 at 13:24
FormContext.itemAttributes
. :D
ctx.CurrentItem.Author
)?
console.dir(ctx)
in OnPreRender
and see what's in it. I just find it (ctx.FormContext.itemAttributes.Id
) this way
Nov 24, 2015 at 13:28