Domino Code Fragment

Code Name*
Web form field change, triggering a JavaScript enabled button on same form
Date*
10/21/1999
Source (or email address if you prefer)*
Zvonko.Paunoski@icn.siemens.de
IP address:.3.128.198.21
Description*
Type*
Formula, HTML, JavaScript
Categories*
User Interface (Web)
Implementation:
Modify constants
Required Client:
NS4
Server:
4.6
Limitations:
This goes deeply in HTML and JavaScript!
Comments:
See comments in code (or code in comments).
Files/Graphics attachments (if applicable): Code:
You have enabled "Web access: Use JavaScript.." checkbox of your database. You lose the submit button and get multiple button feature.
How does Domino recognize which button, section, action was Clicked?
It do it by saving into a hidden variable the element-id of the clicked action.
When you look into HTML source of such a page you will find this variable:
[INPUT TYPE=hidden NAME="__Click" VALUE="0"]
(Please change all [ to < and all ] to > , o.k.)
Submit of the page is done by the JavaScript function _doClick(v) which you can see above of this hidden variable.

So now suppose you want to submit the form when the user enters the contents for the filed: Lastname and you want to start the agent LDAPsearch. First you need a button doing the LDAPsearch call. The hotspot action behind this call is:
@Command([ToolsRunMacro];"LDAPsearch")
Let us suppose this is the first button on the form. Then you need a new JavaSript function doing the same a button click as with mouse.
Here is the source:
[script]
function callSearch(){
ref=document.links[0].href;
beg = ref.indexOf("'")+1;
end = ref.indexOf("'",beg);
xref = ref.substring(beg,end);
document._reg.__Click.value =xref;
document._reg.submit();
}
[/script]

Put this code anywhere on your form, make it passthrough or HTML style.
This function is hard wired to first button! Do it parameterized if you prefer.
So, to call this submit function after user completed Lastname field go to: HTML Attributes
of this Lastname field and enter this:
"size=60 onChange=\'callSearch()\'"

Now this form is submitted when user finish entering Lastname field and hits ENTER or TAB button.

P.S.: In my example the name of the form was: reg. Therefore you see the objects like: document._reg.submit
Therefore look into _doClick(v) function of your HTML page source and adjust the variable names for your form.