So I am trying to figure out how to use some java script in order to use a modal dialog to display new item form. The below is what I have thus far, but its not working and I am not sure what portion is wrong, missing, etc.
//use a button for example
<input type="button" value="Launch Dialog" id="myDialog" onclick="openDiaForm();"/>
//inside script tags under PlaceHolder Main
function openDiaForm()
{
var diaOptions = SP.UI.create_DialogOptions();
diaOptions.url = 'http://mySPDev/sites/jQueryPractice/Lists/ExampleList/NewForm.aspx?ID=' + 1 + '&IsDlg=1';
diaOptions.url += "?Source=" + document.url;
diaOptions.width = 400;
diaOptions.height = 300;
diaOptions.title = "My Custom Dialog Form";
diaOptions.dialogReturnValueCallback = function.createDelegate(null, CloseCallBack);
SP.UI.ModalDialog.showModalDialog(diaOptions);
}
function CloseCallBack(result, returnValue)
{
if (result == SP.UI.DialogResult.OK)
{
alert('clicked ok because I do not know how to work with result yet!');
}
else
{
alert('click cancel because I still do not know how to work with result!');
}
}
So basically I am just looking at learning how to open a new item form for a list in a modal dialog. I have yet to get to working with the result in order to do this, but for now I can't seem to get the dialog to come up. Again, I found an example and am trying to learn from what I have but need some help; any help with this is greatly appreciated as always!
EDIT: forgot to mention that I do have the script reference to sp.js
in the page; have other javascript/jquery actions working fine.