cancel
Showing results for 
Search instead for 
Did you mean: 

DisplayForm

yassra
Champ in-the-making
Champ in-the-making
HI everybody,

I'm new to alfresco and i'm struggling to use this javascript method,

Alfresco.util.PopupManager.displayForm(config)
Displays a form inside a dialog
Parameters:
config
config.title
{String} The dialog title
config.properties
{Object} An object literal with the form properties
config.success
{Object} A callback object literal used on form success
config.successMessage
{String} A submit success message
config.failure
{Object} A callback object literal used on form failure
config.failureMessage
{String} A submit failure message

actually i'm having a problem with how to initialize parameters, if someone can give an example of how to use it, i will really appreciate it .

Thank you
7 REPLIES 7

mitpatoliya
Star Collaborator
Star Collaborator
Could you please also tell your requirement there may be easier ways to achieve that?
What link you are referring to do this?
Please give more details.

yassra
Champ in-the-making
Champ in-the-making
Thank you for responding.

i would like that the handler of a button in my webscript can open a pop up with a form on it, so that i can upload files, videos  to alfresco. I thought this method is useful but i didn't know how to make a use of it.


Thanks again 

mitpatoliya
Star Collaborator
Star Collaborator
Which version of alfresco you are using?

yassra
Champ in-the-making
Champ in-the-making
I'm using the 4.0 one

eric_soto
Champ in-the-making
Champ in-the-making
yassra,

This is an example of a very basic function for editing a node in Share using the Alfresco.util.PopupManager.displayForm. When called this function will present a form containing the fields (properties) of a given node which can then be edited.


function updateElement(nodeRef)
{
    Alfresco.util.PopupManager.displayForm(
    {
        title: "My Title",
        properties:
        {
            mode: "edit",
            itemKind: "node",
            itemId: nodeRef
        },
        success:
        {
            fn: function()
            {
                // do something if successful
            },
            scope: this
        },
        successMessage: "Update of node " + nodeRef + " was successful.",
        failure:
        {
            fn: function()
            {
                // do something if failure
            },
            scope: this
        },
        failureMessage: "Update of node " + nodeRef + " failed."
    });
}


The updateElement() function can be called like this:


updateElement("workspace://SpacesStore/0ee0f1b7-fc33-4367-bf85-7fb014bcbae2");


Note: this is client-side code, not server-side.

Hope this helps. Cheers!

eric_soto
Champ in-the-making
Champ in-the-making
yassra,

If you are uploading files perhaps you might want to consider instead using Share's File Uploader which presents a file picker for choosing files to be uploaded and automatically sends them to the Alfresco Repository. Here is an example of how it might be used:


// Prepare variable for destination (a container or folder)
var destination = "workspace://SpacesStore/b9acc49b-8772-48b1-be23-f0198c32b4a0";

// Get instance of the file uploader
var fileUpload = Alfresco.getFileUploadInstance();

// Prepare filters
var description = ["JPEG file", "JPEG file", "PNG file", "GIF file"];
var extensions = ["*.jpeg", "*.jpg", "*.png", "*.gif"];

// Prepare config object for File Uploader (image/file picker)
var fileUploadConfig = {
    mode: fileUpload.MODE_MULTI_UPLOAD,
    destination: destination,
    overwrite: true,
    filter: [
        {description: description[0], extensions: extensions[0]},
        {description: description[1], extensions: extensions[1]},
        {description: description[2], extensions: extensions[2]},
        {description: description[3], extensions: extensions[3]}
    ]
};

// Call File Uploader dialog
fileUpload.show(fileUploadConfig);


Again, this is all client-side code not to be confused with server-side.

Good luck!

jykke
Champ in-the-making
Champ in-the-making
This says Reference Error Alfresco is not defined;
// Get instance of the file uploader
var fileUpload = Alfresco.getFileUploadInstance();

Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.