Is it possible to call the Javascript CLICK event from Formula language?

On a Web-enabled form I have a HIDDEN computed text field w/ “Computed after validation” checked that is filled via a DBLOOKUP. The formula behind this field is:

@If(Sel_Doc!=“” & Sel_Doc != “—Please Select—”;@Unique(@DbLookup(“”;“”;“(LookupUnID)”; Sel_Doc;2));“”);

The variable Sel_Doc is a document the user selects from a combobox on this same form and the DBLookup in this field returns the full URL of the selected document.

I need the CLICK event of a hidden button to be activated upon this field being filled so the selected document is opened in frame 2 on the screen.

Is it possible to trigger the Click event of a button, via formula language? Or is it possible to open the URL of the selected document in an other way without hidden buttons?

(Code needs to work in Notes 5 and 6)

Thanks,

Chad

Subject: Is it possible to call the Javascript CLICK event from Formula language?

Yes,Create a button with your @formula code in it. Give this button an HTML ID name. Then after the user event you have captured call the click event of the button.

btnName.click();

regards

Andy

Subject: RE: Is it possible to call the Javascript CLICK event from Formula language?

Thanks Andy,

But I can not seem to get the Formula within the Click event of the button to be recognized, the form is used on the Web if that makes a difference? Here is my coding:

On the combobox OnChange event:

document.forms[0].B1.click();

document.forms[0].B2.click()

Within Button1 (B1) click I have the formula:

@Prompt([OK];“Button1”;“Button 1”);

FIELD testfld := testfld;

@SetField(“testfld”;@If(Sel_Doc!=“” & Sel_Doc != “—Please Select—”;@Unique(@DbLookup(“”;“”;“(LookupUnID)”; Sel_Doc;2));“”))

Within in Button 2 (B2) I have:

alert(“Made it to Button 2”);

parent.frames[1].location = document.forms[0].testfld.value;

I never get the prompt from Button1 and testfld is never filled. However I do get the prompt from button 2.

Any idea why?

Subject: RE: Is it possible to call the Javascript CLICK event from Formula language?

For starters, take the @Prompt out of the button - can’t do that from a web client.

FIELD testfld := testfld;

@SetField(

“testfld”;

@If(

Sel_Doc != “” & Sel_Doc != “—Please Select—”;

@Unique(

@DbLookup(“”;“”;“(LookupUnID)”; Sel_Doc;2)

);

“”

)

)

hth,

dgg

Subject: RE: Is it possible to call the Javascript CLICK event from Formula language?

Thanks Dallas,

I removed the @Prompt now, I was just trying to get something to indicate that Button1 is actually being called.

I’ve simplified the code behind the button even more and it still does not fill my field called “testfld”. Here is the simplified code:

FIELD testfld := testfld;

@SetField( “testfld”;@DbLookup(“”;“”;“(LookupUnID)”; Sel_Doc;2))

Any other ideas? Thanks for the help, this task has been more frustrating than I had first anticipated.

Chad

Subject: RE: Is it possible to call the Javascript CLICK event from Formula language?

To test whether or not the button is being clicked, try putting this in the button:

@URLOpen(“javascript: window.status ="button clicked . . ."”)

So the code for the button might look something like:

@URLOpen(“javascript: window.status ="button clicked . . ."”)

View := “(LookupUnID)”;

KeyVal := Sel_Doc;

ColumnNo := 2;

FIELD testfld := @IfError(@DbLookup(“” : “”; “”; View; KeyVal; ColumnNo); “An error has occurred . . .”);

hth,

dgg