cancel
Showing results for 
Search instead for 
Did you mean: 

Javascript with parameter

gianluca
Champ in-the-making
Champ in-the-making
Hi all,

I'd like to know if it is possible to pass a parameter to my js script.
For example, I want to pass dinamically (from a form) the string to search to my searching script…

http://xxxxxx:8089/alfresco/command/script/execute?scriptPath=/Company Home/xxxxxx/myscript.js&stringtosearch=….

It's possible? How can I do that?

Thanks in advance,

Bye.
4 REPLIES 4

kevinr
Star Contributor
Star Contributor
Yes arguments are indeed supported:
http://wiki.alfresco.com/wiki/JavaScript_API#Root_Scope_Objects
http://wiki.alfresco.com/wiki/URL_Addressability#Script_Command_Processor

The 'args' object will contain a map of name/value pairs of any URL arguments passed to the servlet.

Thanks,

Kevin

gianluca
Champ in-the-making
Champ in-the-making
Many Thanks!
So, I can use for example:

Var myvar = args["stringtosearch"];

:?:

kevinr
Star Contributor
Star Contributor
Yes you can.

Thanks,

Kevin

gianluca
Champ in-the-making
Champ in-the-making
Thank you very much, Kevin.

Smiley Very Happy