开发者

JavaScript auto-POST with NAME

I have an OnBase e-Form that I'm building. There are three buttons on the form that all submit. OnBase does different things based on the name of the button used to submit the form. If the button has a name of OBBtn_CrossReference it opens another window with a cross referenced document. I need to programmatically 'click' that button.

I've开发者_StackOverflow中文版 read several posts about how to use JavaScript to submit a form, but none seem to accomplish my goal. I just need to POST and to have it appear to come from a button named OBBtn_CrossReference.

I don't need to submit any data. The way the page is currently set up, the entire page is already a form and since I don't want to break the functionality of the other form buttons it seems I must leave it that way.

UPDATE: The suggestion below was tested as a call from the onload event in the body tag and since the button posts the page reloads and the call is made over and over again spawning unlimited child windows. I would appreciate a suggestion on how to get the button to only be clicked the first time the page is loaded and not on postback.


There's a click() method on links, buttons, checkboxes. For example , I submitted this comment by running document.getElementById('submit-button').click() from chrome's command line.


I know I am a little late to this post, but you can try and leverage a cookie to get this done:

if (document.cookie.indexOf('xref=true', 0) < 0) {

    // Set the xRef cookie, so we do not fire it again for this form.
    document.cookie = 'xref=true';

    //alert(document.cookie);
    document.getElementById("OBBtn_CrossReference").click();
}
else {

    document.cookie = "xref=false";
    //alert(document.cookie);
}

I tested this on the Thick and Thin clients in 10.0 and it worked fine.

The postings on this site are my own and don't necessarily represent my company's positions, strategies or opinions.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜