Quantcast
Channel: SharePointCommunity
Viewing all articles
Browse latest Browse all 6649

Custom newfrom (upload a picture and fill in the picture url)

$
0
0

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 


Viewing all articles
Browse latest Browse all 6649


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>