I'd like to create a task with a pre-filled title, as well as set some other properties. I found this documentation that says I can pass arguments when i call
SP.UI.ModalDialog.showModalDialog(options);
http://msdn.microsoft.com/en-us/library/ff410058.aspx
This is what I have so far:
<script type="text/javascript">
var modalDialog;
function ShowActionItemDialog(title, questionId) {
var options = {
url: '/Lists/Tasks/NewForm.aspx',
title: questionId + ': ' + title,
questionId: questionId,
allowMaximize: false,
showClose: false,
width: 800,
args: {
title: title,
questionId: questionId
},
height: 600
};
modalDialog = SP.UI.ModalDialog.showModalDialog(options);
};
</script>
I have not been able to find any documentation for what args are supported. I would accept either an answer showing me how to find this information, or providing a better alternative for passing this information to the dialog. I need to invoke the dialog when a radio button is clicked, so I believe I need to do this with javascript.
Thank you!
Edit: The code from the link in the accepted answer works, but you'll need to make sure the client OM js is completely loaded
I added this code to NewForm.aspx in Sharepoint Designer:
<script type="text/javascript">
ExecuteOrDelayUntilScriptLoaded(procAuditArgs, "sp.js");
function procAuditArgs(){
var args = SP.UI.ModalDialog.get_childDialog().get_args();
}
</script>