Dbcolumn in web application

hi alli had written an agent in formula language to get dbcolumn value. i have to get that value on onchange event of field. i am opening that agent with

window.location=“http…?openAgent”;

what should be the next sentence to save the dbcolumn value to an variable by javascript. i guess it should be something like…

var dbcolumnValues=…

i am not getting what should be next…

can anyone please tell me

thanks in advance

Subject: dbcolumn in web application

Hi Mary. I wrote next code, it works as DBCOLUMN in Web. As you can see, it needs works beetwen Form (JS Header, On load and OnChange form and field events) and Agent.

SEND VARIABLES BETWEEN FORM AND AGENTE

This code in JS Header form

function ejecutaagente(agente, campos) {

agente +=“?openagent”;

nomVec = campos.split(“,”);

for (i=0; i<nomVec.length; i++)

agente += “&”+ i +nomVec[i] ;

agente = agente.substring(0,agente.length);

agente = agente + “!FIN”;

location.href=agente;

}

function inicializaagente()

{

path = window.location.pathname.toLowerCase()

var nsfPos = path.indexOf(“.nsf”);

path=path.substr(0,nsfPos+5);

servidor=window.location.hostname;

nomagente=“001UnidadRevisa”;

agente=“http://”+servidor+path+“/”+nomagente;

var campo1 = document.forms[0].uoClave.value;

var campo2 = document.forms[0].uoCID.value;

var campos = campo1 + “,” + campo2;

ejecutaagente(agente,campos);

}


This code in your Onload event form

cadVariables = location.search.substring(1,location.search.length);

arrVariables = cadVariables.split(“&”);

for (i=0; i<arrVariables.length; i++)

{

// alert(arrVariables[i]);

}

if (i>1)

{

var juoClave = arrVariables[1];

var juoCanSave = arrVariables[2];

document.forms[0].uoClave.value = juoClave;

document.forms[0].uoCanSave.value = juoCanSave;

}


This code in OnCHange event about field that will evaluate

inicializaagente()


Agent

Agents cannot run in a browser. They can be activated from a browser but run on the Domino server containing the agent.

Setting up a Web agent

Using the Agent Properties box, do the following:

Check the “Shared” option when you create the agent.

Set the agent trigger to “On event” and either “Agent list selection” or “Action menu selection.”

Set the agent target to either:

“None” for agents that work on the current document such as those launched from WebQueryOpen or WebQueryClose, or a form action or hotspot that works on fields in the current document.

“All documents in database” for agents that work on existing documents such as those launched from the OpenAgent URL or a view action. The actual documents processed depend on the agent code, for example, the SELECT statement in a formula or the UnprocessedDocuments property in LotusScript.

Check “Run as web user” on the Security tab to run the agent using the browser login name. Otherwise the agent runs with the rights of the agent signer.

Agent Code:

Sub Initialize

Dim s As New NotesSession

Dim db As NotesDatabase

Dim doc As NotesDocument

Dim arg As String, p1 As Long



arg = s.DocumentContext.Query_String(0)

p1 = Instr(arg, "&0")

p2 = Instr(arg, "&1")

pFIN = Instr(arg, "!FIN")

If p1 = 0 Or p2=0 Then

	

	Print "<SCRIPT LANGUAGE = JavaScript>"

	Print "alert('Error, debe introducir el valor del campo Clave')" 

	Print "path = window.location.pathname.toLowerCase();" 

	Print "var nsfPos = path.indexOf('.nsf');"

	Print "path=path.substr(0,nsfPos+5);"

	Print "servidor=window.location.hostname"

	Print "var docto='http://'+servidor+path+'/001Unidad?OpenForm"

	Print "</SCRIPT>"

	

	Exit Sub

Else

	vuoClave = Mid(arg, p1 + 2, p2 - p1 - 2)

	vuoCID = Mid(arg, p2 + 2, pFIN - p2 - 2)

	

	Set db= s.currentdatabase

	Set view = db.GetView( "001UnidadXClave" )

	Set doc = view.GetDocumentByKey( vuoClave )

	If Not (doc Is Nothing) Then

		vuoCanSave = "SI"

		Print "<SCRIPT LANGUAGE = JavaScript>"

		Print "alert('Ya existe la unidad  " + vuoClave +"  no se guardará el documento')" 

		Print "path = window.location.pathname.toLowerCase();" 

		Print "var nsfPos = path.indexOf('.nsf');"

		Print "path=path.substr(0,nsfPos+5);"

		Print "servidor=window.location.hostname"

		Print "var docto='http://'+servidor+path+'/001Unidad?OpenForm"

		Print "</SCRIPT>"

	Else

		vuoCanSave = "SI"

		Print "<SCRIPT LANGUAGE = JavaScript>"			

		Print "path = window.location.pathname.toLowerCase();" 

		Print "var nsfPos = path.indexOf('.nsf');"

		Print "path=path.substr(0,nsfPos+5);"

		Print "servidor=window.location.hostname"

		Print "var docto='http://'+servidor+path+'/001Unidad?OpenForm&" +vuoClave+"&"+vuoCanSave+"'"

		Print "location.href=docto;"

		Print "</SCRIPT>"			

	End If	

	

	Exit Sub

End If

End Sub

I hope it help you