Update Document property in a java script

I'm running a custom XHTML layout where I'm running a script that makes a function that updates a document property. I'm trying to get it triggered by the onclick of a commandButton. So when the commandButton is pressed, in this example, I want the title of the document to be updated to “My Folder 2”. Here's the script that I have:

function myFunction() {

DocumentModel doc = doc=env.getDocument();

doc.setPropertyValue(“dc:title”, “My Folder 2”);

doc = session.saveDocument(doc);

}

And then I run the commandButton part and I have onclick=“myFunction();” Nothing happens when the button is pressed though. Any ideas? Thanks!

0 votes

0 answers

1729 views

ANSWER