I have to customize an announcement list new and edit form.
In the form is there is a Picture Colum. But I don’t want the user to go first to a picture library, upload the picture, copy the picture url and fill in the url in the announcement list form.
In the Internet I found this helping jScript (http://spimagefieldupload.codeplex.com/).
//If the link is clicked, show the existing RteUploadDialog.aspx page as a popup
var dialog = {
url: SP.Utilities.Utility.getLayoutsPageUrl(“RteUploadDialog.aspx”) + “?LCID=” + SP.Res.lcid + “&Dialog=UploadImage&UseDivDialog=true&Source=” + encodeURIComponent(window.location),
allowMaximize: true,
showClose: true,
width: 500,
height: 160,
dialogReturnValueCallback: function (success, html) {
if (success) {
//Gets the picture’s url from the popup, shows it and hides the links
var $emptyPanel = jQuery(“#” + selectorId + “_EmptyPanel”);
var $assetSelectedPanel = jQuery(“#” + selectorId + “_AssetSelectedPanel”);
var $imageFieldDisplay = jQuery(“#” + selectorId + “_ImageFieldDisplay”);
$imageFieldDisplay.html(html);
$emptyPanel.css(“display”, “none”);
$assetSelectedPanel.css(“display”, “inline”);
}
}
};
thisDialog = SP.UI.ModalDialog.showModalDialog(dialog);
But how i can change the script (dialogReturnValueCallback: function) so that the picture url and the picture name is stored in jScript Variables in the form. So I can write I back in the form fileds.
Thanks for your help
Hey Stefan,
What exactly are you trying or wanting your users to do? It seems that you want them to create an announcement and if necessary upload or add an image. Is that correct?
One other question, will all announcements contain an image or just some?