0

I am developing an SAP BSP web application that includes a form with a submit button. When I manually click the button everything works fine, the round trip to the server is made.

Now in certain situations I want to call this submit button via JavaScript, so I do a simple

document.getElementById('MyButton').click( );

On the first sight this seems to work fine, again the round trip is being made. However, internally in the SAP web framework this does not behave exactly the same as manually clicking the submit button. It seems some parameters are not set or at least set differently.

I am not sure yet what exactly the difference is, as I am not fully aware how the SAP framework does its things (debugging it at the moment). But in order to better find the issue I would like to know:

From a technical perspective, what is the difference in manually clicking a HTML form submit button to calling the button's click() method via JavaScript?

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
Matthias
  • 9,817
  • 14
  • 66
  • 125
  • I believe using .click( ) will not provide the form scope when clicked, as compare to the button click, which performs a complete action of submitting the form. – Wasif Ali Oct 04 '17 at 10:52
  • Take a look at [**this answer**](https://stackoverflow.com/a/12376293/3669624) for [**Auto-Submit Form using JavaScript**](https://stackoverflow.com/questions/12376173/auto-submit-form-using-javascript) – cнŝdk Oct 04 '17 at 10:52
  • @chsdk Thanks, but unfortunately calling the `submit()` method of the form does not help either, same result. – Matthias Oct 05 '17 at 10:07

0 Answers0