Notes Client: Javascript Submittal

I am trying to use some creativity to solve a dynamic content issue I’m having with Notes.

Can you submit a document from the Notes Client using javascript?

The alert properly comes up but the Notes Client Document does nothing. I’ve searched this forum thoroughly and found nothing about this kind of functionality.(except for field validation … don’t need that)

function submitTask(lineItem)

{

alert('submit task #'+lineItem);

var doc = this.document.forms[0];		doc.submit();

}

I’m having to do this because Notes doesn’t allow for programmable hotspots being built on the fly :frowning:

Subject: Notes Client: Javascript Submittal

this.document??? Neither a JavaScript function nor a button that invokes it owns a document object. You can change the code to:

var doc = document.forms[0];

– although that’s just plain confusing, since a variable named “doc” would naturally be associated with a document object, not a form.

Since you’re not using the form object for anything else at this point, why assign it to a variable at all? Simply use:

document.forms[0].submit();

Subject: RE: Notes Client: Javascript Submittal

Stan, thanks for responding.My fault there. I posted bad code. I had been trying all sorts of different formatting that I could find online.

I have tryed the document.forms[0].submit();

Just didn’t think it was working, so I tryed looking online for an alternative - Notes has a history of querkie behavior. Thought I might have to call it some special way … LOL …

I quess what I would really like to know is: does the QuerySave Event get invoked when a document.forms[0].submit(); occurs ? BECAUSE that is what I’m expecting to happen and I get nothing.

Is there anyway to get the Lotuscipt/Javascript to communicate effectively?

My idea was to have a hotspot on the form call a js function which would submit the form and set a field value marking it was submitted via JS. Then, in the QuerySave Event I would be able to “Key” on a flag set by the JS submittal function.

Subject: RE: Notes Client: Javascript Submittal

Odd – it used to work when I was a kid (R5), but I’d never used it in production. Testing with 7.0.2 says uh-uh. Hmmmmm.

Subject: RE: Notes Client: Javascript Submittal

Using JavaScript, you can always programatically click a button that executes LS or formula code, but that isn’t really what QuerySave would give you …

Subject: RE: Notes Client: Javascript Submittal

OK, another detail left out. The JS would be called from a graphic hotspot on the form. I believe that removes the ability to call LS or @Commands.

That is why I need the ability to tell QuerySave, save but not really - I just want to do this - go out and preform this LS update to my current document.

In the querySave I was planning on having an audit immediately:

’ this would be set by js event before the submittal

jsAction = doc.jsAction(0)

if jsAction=“” then

’ do nothing continue

else

’ preform some kind of action needed

Call mySpecialFunction(jsAction)

Continue = false

end If

Anyways, this is what I was thinking. I guess I will have to use hard coded linked hotspots to the graphics for now.

Unless, I\We can figure tis bit out.

Subject: RE: Notes Client: Javascript Submittal

“OK, another detail left out. The JS would be called from a graphic hotspot on the form. I believe that removes the ability to call LS or @Commands.”

No, it does not.

Have a button calling your LS/@Functions, on the HTML tab assign a name attribute (not ID for this purpose) like “myButton”. Then in your graphic hotspot add to your JS code

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

As I said, it will not give you QuerySave functionality, but you can call @Formulas and LotusScript from within your JS code. Which, of course, will not care to wait for the formula to terminate. If it would, it would be easier to fake some kind of Continue = False. You could still try to set a flag field and poll for that in your JS.

The button myButton can even be hidden.