Javascript to submit xpage

I am attempting to use javascript to submit an xpage. In the past with forms, we could usedocument.forms[0].submit()

I have a javascript library with a function that gets a handle on the form object with document.getElementById(“formName”);

Now, in trying to submit that form,

document.getElementById(“formName”).submit();

I get an error stating that the “object doesn’t support this property or method”.

There are no other submit elements on the form, so it is not due to a submit button or other element interfering with the call.

Any ideas why I get the error???

Subject: I could not do this, either…

  • I didn’t get an error, but what happened when I used the old-style submit(), it would not trigger any XPage events, like postSaveDocument. I tried two things:
  1. If you have a save button on your XPage it’s possible to have CSJS “click” that button, thereby causing a save to take place. I found this on the web somewhere.

  2. Look at Jeremy Hodge’s post on the XPages Blog about triggering ad-hoc server-side events. Basically you may define an eventHander that’s not “associated” with any control on the XPage, then call that from CSJS at any time to perform the server-side actions.

  • There may be other solutions. These are simply what come to mind.

Hope this helps…

Subject: xpage action post

I was able to work around this to test the form submission. I would still like to know how to use the javascript method to submit as I put the pieces together.

However, the post action of my form does not work as expected because the xpage has an action and method already defined by domino. Where can I override these?