2 approaches:

1 (easy) - write a form with some fields that create a new document with a
computed name. It will not rename the document if you change the fields
afterwards, but depending on your use-case, it might be enough.

2 (more complex) - write a listener component that rename the document, if
needed, every time a document is saved. It needs to be written in Groovy or
in Java. See:
http://platform.xwiki.org/xwiki/bin/view/DevGuide/GroovyNotificationTutorialand
http://platform.xwiki.org/xwiki/bin/view/DevGuide/WritingComponents

Louis-Marie


2014-03-20 15:53 GMT+01:00 DeHaynes <[email protected]>:

> I thought so also, so I looked into the JavascriptExtension and put the
> following code into it.
>
> document.observe("xwiki:actions:saved", function(event){
>   var doContinue = event.memo['continue'];
>   if (doContinue) {
>     alert('Saved It.');
>   }
> });
>
> The alert did not fire when I clicked the saved button.  So I moved the
> alert outside of the "If" block.  It still did not fire.
>
> While digging into this further, it occurred to me that I cannot just
> change
> the value of some "DocumentName" field on the form because the document
> document name is not on the form.  So I would have to reach into the XWiki
> object model somehow.  I could not find an example of that or an API
> listing.  I decided to drop this researching the javascript solution
> because
> what I really want to happen is going to occur at the server, not the
> browser.
>
> So I am not trying to figure out if there is another way to approach this.
> I would love to know your thoughts on my logic.  That could help me
> determine which way is the correct way to accomplish this.
>
> Thank you.
>
>
>
> --
> View this message in context:
> http://xwiki.475771.n2.nabble.com/Change-Title-On-Save-tp7589667p7589731.html
> Sent from the XWiki- Dev mailing list archive at Nabble.com.
> _______________________________________________
> devs mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/devs
>
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to