Read mode on the web - run an agent with confirmation?

Hi everyone,

On a web form, in READ mode, I need a hotspot to cancel a document, e.g.

@Command([ToolsRunMacro]; “(CancelThis)”).

Problem is, I need user’s confirmation first.

I thought this would trigger onsubmit event, where I could put my JS confirmation.

Nope, no onsubmit in read mode…

There are many options to achieve this from edit mode, but in read mode nothing worked.

May be window.location = “…?openagent”?

Is there more simple way?

I’ll appreciate any help.

Thanks,

Simeon

Subject: Read mode on the web - run an agent with confirmation?

You can use Javascript to get the confirmation and run the agent.

i.e.

if confirm(“Are you sure ?”) {

location.href = “http://server/db.nsf/agentname?openagent”

}

cheers !!

Ashish

Subject: RE: Read mode on the web - run an agent with confirmation?

Okay, but how can I compose the url without hard-coding it in READ mode?

Thanks,

Simeon

Subject: RE: Read mode on the web - run an agent with confirmation?

We don’t need any steenking hard-coding! It’s just HTML, and HTML is just text. Use passthru and Computed Text for the URL:

“http://” + @GetHTTPHeader(“Host”) + “/” = @WebDbName + “/agentname?OpenAgent”

Subject: RE: Read mode on the web - run an agent with confirmation?

Thanks Stan,

I tried this, but the agent fails to send the messages required.

I assume it can’t use session.DocumentContext.

The very same agent works fine when invoked by @Command([ToolsRunMacro]; …).

Any ideas?

Thanks,

Simeon

Subject: RE: Read mode on the web - run an agent with confirmation?

It can use DocumentContext, but the context won’t be the Notes document – jus the request. However, you can use context.HTTP_Referer(0) to get the URL, which should let you get the UNID or lookup key, which will give you the document, which will let you do whatever you need to do. (You could also feed values in the URL and get them out of Query_String.)

Subject: RE: Read mode on the web - run an agent with confirmation?

Stan,

Now I got it - it worked by passing UNID thru Query_String. Thanks.

I still can’t believe there is no easier way…

This little thing has probably the highest effort/result ratio of anything I’ve ever done.

Thanks again,

Simeon