Run Agent in Web

Hi there,I already did a search but I could find anything what helps me so I hope there is someone out there who can give me a hint.

:slight_smile:

I am developing a Web-Database which runs after saving a lotus script agent.

I already tried to run it in “WebQuerySave” the problem with that is that I have got validations in my form which are checked over “onSubmit”

If I save the doc the agent runs even if the validation says there is an error.

So i tried handeling it with a field… the validation set a field… “WebQuereySave” checks that on and runs the agent only if I get an ok. But that didn´t work also.

Next try…

I but

window.location.href = “/folder/database/agent?OpenAgent”

after my validation in “onSubmit” but the agent won´t run.

Okay I can run a scheduled agent but I would be nice if I can run it with after validation and my doc-save.

can somebody help?

thx!

Subject: Run Agent in Web

Add your agent to the WebQuerySave as usual. In the JS Header add the following functions:

function saveDocument(){

if(confirm("All changes will be saved. Do you wish to continue?" ))

{

   var checkFields = validateFields();

	if(checkFields == true){

			document.forms[0].submit();

    	}else{

    		return false;

    	}

 

}else{

	return false;

}

}

//Function for validating the form

function validateFields(){

var f = document.forms[0];

var e = “”;

if(f.EmployeeName.value==“”)

{

e = e + "- You must select an Employee Name\n";

}

if(f.Supervisor.value==“”)

{

e = e + "- You must select a Supervisor\n";

}

if(e!=“”){

alert(e);

return false;

}

return true

}

On your save button set to Common Javascript and add the following call:

saveDocument();

The form will not submit until all validations have passed.

Subject: RE: Run Agent in Web

Many many thanks patricia!!!I just missed

document.forms[0].submit();

:slight_smile:

I need to go home…

again thx for your quick help!!