WebQuerySave and $$Return and field validation using javascript

I have a form with a “Submit” button with javascript code that validates fields. Here is the code:if(validate(frm.RequestorName) && validateSenator() && validate(frm.MailDate) && validateCreateLabel())

{

// _getEditAppletData();

frm.submit();	

frm.close();

}

Then in the WebQuerySave event I call an agent, here is the code:

@Command([ToolsRunMacro]; “SendCWEmail”);

@Command([FileCloseWindow])

I also have a $$Return field on the form with the value:

“”

So, my problem is after I click on Submit, it triggers the email agent but it does not bring me back to the OpenOrders form, instead it leaves me on a white blank screen. So, my question is, how do I get back to the form that is named in the $$Return field. This works when I take out the code in WebQuerySave. But, I need to call the agent after it submits the document, so I need to keep the code in WebQuerySave. Any suggestions?

Subject: WebQuerySave and $$Return

Since your $$Return seems only to open a form, perhaps you can use the formula language instead of JavaScript. I routinely use WebQuerySave to send email confirmation, then I present the user with a message and a link to the URL where they should go. Yes, this does not force them there like you want, but perhaps it will help get you closer to what you want.

"

Thank you for your registration.

Click here for the HR Form

"

Subject: Place $$Return code inside @Return

Christine, I placed your code inside of an @Return, and that worked for me.

@Return(

“”

)

Subject: found solution

I solved the problem by putting this statement as the last line in the LotusScript agent:

Print “[”+“http://server/Helpline.nsf/Home?OpenForm"+"]”