‎2006 Mar 13 10:11 AM
Hello everybody,
business needs require, that we do some checks on data entered in a form before we save the information to the R/3 System. After trying several ways with the event handler "onInputProcessing", the question came out, if it would not be easier to do the validation via JavaScript. The issue there is that we have to validate the data against a table in R/3. Is it possible to call a function modul, that deliveres true or false, directly from JavaScript?
Cheers,
Stephan
‎2006 Mar 13 10:17 AM
Hi Stephan,
Since you need to validate data against the tables it would be much better to validate in the server itself.
Since the need of using Javascript is lost here.
And I dont think that you can make a call to the server from the Javascript. You can better make a try using Remote Enabled Function Modules.
Regards,
Wenceslaus.
‎2006 Mar 13 10:14 AM
Hi Stephan,
I think you can better use the BSP forum for this post.
Regards,
John.
‎2006 Mar 13 10:17 AM
Hi Stephan,
Since you need to validate data against the tables it would be much better to validate in the server itself.
Since the need of using Javascript is lost here.
And I dont think that you can make a call to the server from the Javascript. You can better make a try using Remote Enabled Function Modules.
Regards,
Wenceslaus.
‎2006 Mar 13 10:20 AM
In future please post BSP related questions in BSP forum.
Coming to your question:
to check the input value against database table you have to do a server event, with just javascript (which is client side only) you cannot validate against table values.
However , if your intention is to avoid the server rountrip and the resulting reloading of the page, you can achieve this with the use of AJAX programming.
Regards
Raja
‎2006 Mar 13 10:26 AM
Hi,
The solution we use is calling a BSP page in a popup. In that popup you do the validation of that field via the an FM in the oninitialisation. That'll give back is something is valid or not. In the layout of that popup, you nothing else than updating a JS variable indicating that it's valid or not and close itself.
Alternatively you can do everything in the oniputprossing of the original page and you work with different event_id. When you come to the case of the input validation, you call that FM and put the result an a ABAP var. You do no page navigation, thus the original page will be reloaded wher you can check if the abap var contains a certain var and than create the JS for an eventual alert. This method requires good bookkeeping of all variables and stuff.
The first method is thus preferable.
Eddy