Composing document on Web using louts script?

i want to compose document for web application using lotus script? in client i know that , i have to do workspace.composedocument…

but as workspace doesn’t work on web…what could the alternative in lotus script…

Subject: Composing document on Web using louts script?

The only way to use LotusScript in web applications is through agents, either called by URL command or as WebQueryOpen and WebQuerySave agents. Since you don’t have access to NotesUI classes, the only option would be to have an agent print out a URL command to open a form. Since you can have the same building a URL string directly, this would be nothing but waste of resources.

If you don’t want to build a URL to open a form, use @Command([Compose]; “FormName”). As long as the database property to use JavaScript when generating pages is set, this will work for you.

Subject: RE: Composing document on Web using louts script?

Using the Compose @Command is a better choice for composing document on web instead of using Lotus Script. If still LS is mandatory for this purpose, we can include the Print statement in the agent for invoking the JavaScript function as below:

nurl$=“http://”+doc.GetItemValue(“Server_Name”)(0)+“/”+doc.GetItemValue(“DbPath”)(0)+“/Test?OpenForm”

Print |<A HREF="JavaScript:Compose()"><FONT COLOR="BLUE">Compose</A></FONT>|

Print |<SCRIPT language="JavaScript">function Compose() { window.location.href= "|nurl$|" }</SCRIPT>|

Subject: RE: Composing document on Web using louts script?

Could you give an example on why and when it would be beneficial to wrap the url into a JavaScript function instead of simply using it as is? My limited imagination lets me down on this.

Subject: RE: Composing document on Web using louts script?

If we jus want to open a particular URL, then it is not required. Rather incase, we need to pass data to another form using Query_String(CGI Variable), I think wrapping the URL into a JavaScript function will be beneficial. Please let me know if I am wrong.

Subject: RE: Composing document on Web using louts script?

If you were to build a URL string based on field values entered by the user completely in JavaScript (without submitting the original form), that could be a way to do it.

But since we are in a LS agent anyway, all the values of accessible fields we might want to pass should be available anyway. So, we should be able to build the string to our likings.

nurl$=|http://| & doc.GetItemValue(“Server_Name”)(0) & |/| & doc.GetItemValue(“DbPath”)(0) & |/Test?OpenForm&param1=| & doc.GetItemValue(“Parma1”)(0) & |&param2=| & doc.GetItemValue(“Param2”)(0)

Also, using a plain URL instead of setting window.location.href would allow us to get rid of the protocol and server name. According to the JavaScript 1.3 reference, location.href must be fed a full URL (as you did). It seems to work otherwise in modern browsers, but it would not be clean at least. However, this absolute URL has two disadvantages: Even if you uses the Server_Name variable to avoid hard-coding, this still results in a longer URL, thus more text to be retrieved by the browser. The bigger disadvantage is, that a URL set up like that doesn’t work in SSL and non-SSL environments without additional efforts.

Without the use of JS, we could build a URL relative to the server’s root, so it could simply look like this:

nurl$=|/| & doc.GetItemValue(“DbPath”)(0) & |/Test?OpenForm&param1=| & doc.GetItemValue(“Parma1”)(0) & |&param2=| & doc.GetItemValue(“Param2”)(0)

Subject: RE: Composing document on Web using louts script?

Thanks for providing a highly informative message.