Marcus Loza
Marcus Loza

Reputation: 185

Javascript function return in lotusscript agent

I need to make an adjustment in an application developed in Notes, with the classic development without using xpages. The application needs to give the user an alert the moment an action button is clicked. In this button there is a validation in javascript, which when validating successfully submits the form, which in turn executes a lotusscript agent in its webquerysave event. At this point, some processing is performed, and after processing a condition is verified to generate an alert or not. I thought of generating the alert from the confirm function of javascript, but I do not know how to catch the return from the confirm function to know if I keep the agent code or I finish executing and return to the submitted document.

In the application only javascript client side and lotuscript agent are used. I want to know if it is possible from a lotuscript agent to execute a javascript code and return to the lotusscript code of the agent.

Upvotes: 0

Views: 425

Answers (3)

Cal Harris
Cal Harris

Reputation: 67

I'm assuming you're trying to check the record against other data as part of the validation before allowing it to be saved. The problem is once a WebQuerySave agent is called the document is posted and you have to direct the user to a new page. So you need to do your validation before the post.

The simplest way is to do an xhttprequest during your javascript validation routine, before posting. You'll need to call a LotusScript agent (or SSJS Rest service or DDS) that returns a value that you can check against before submitting.

Upvotes: 0

Richard Schwartz
Richard Schwartz

Reputation: 14628

You say that you are executing the WebQuerySave event. That means that you are submitting your form. If this is classic Domino web development with no AJAXy stuff going on, then the moment you submitted the form the code that is already loaded in your browser is done. The WebQuerySave agent will either directly generate or redirect to a new page, whose code will be loaded into your browser in place of what was already there. The logic in that agent will have to generate new script and set the appropriate field values that tells the script to put up your alert.

*And if there is AJAXy stuff going on, you're going to need to show your code in order for people to have enough understanding of what you're doing in order to help you.

Upvotes: 0

Robert Greathouse
Robert Greathouse

Reputation: 41

It would be very helpful to understand what language you are using to "confirm" the response. In most cases a timeout should be sufficient. Are you getting any kind of response at all?

Upvotes: 0

Related Questions