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?
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?
Getting 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?
– Atish Kumar Dipongkor
Nov 24 '15 at 13:24
FormContext.itemAttributes. :D
– Carlos
Nov 24 '15 at 13:25
ctx.CurrentItem.Author)?
– Carlos
Nov 24 '15 at 13:26
console.dir(ctx) in OnPreRender and see what's in it. I just find it (ctx.FormContext.itemAttributes.Id) this way
– Atish Kumar Dipongkor
Nov 24 '15 at 13:28