cancel
Showing results for 
Search instead for 
Did you mean: 

Validate button in adobe forms

Former Member
0 Kudos

Dear Readers,

I have a validate button set up in an online interactive adobe form. Now I have created an action 'Validate' in the underlying ABAP webdynpro. How do i tie the 'validate' button in the interactive form to the underlying action.

Under the execute tab, for the button, it is asking me to create a new data connection. I am kinda confused. Why can't I use the existing data connection? from which I have access to the underlying context elements of the web dynpro.

~thank you for reading and appreciate any answers.

Accepted Solutions (1)

Accepted Solutions (1)

chintan_virani
Active Contributor
0 Kudos

There is only event available i.e. onSubmit so you will have to call it and do your validations there.

Alternatively why don't you do the validations within the form itself using FormCalc/JavaScript?

Chintan

Former Member
0 Kudos

Thanks Chintan, I have run the validation on the underlying SAP tables; perform some select statements and check the existence of materials, plants etc. How do i use the onSubmit validation?

chintan_virani
Active Contributor
0 Kudos

Well in that case you will have to put a hidden field on form, bind it to WD context, set it's value to say 1 from Adobe when your validate button is clicked.

now inside the onSubmit event put an if else condition, check the variable value and fire your validations else submit the data to backend.

I think this issue has been discussed here @ SCN, just Search for it and you will get solution.

Chintan

Answers (2)

Answers (2)

Former Member
0 Kudos

Neha,

I have a very complex form that requred 12 - 15 validations. What I did was when the user clicked the Submit button, I made all the validation checks on the Web Dynpro side since I'm new to Formcalc.

in my onSubmit method, after I read my Context data, I call a validation method which makes sure all the appropriate data is filled in and dates match etc.... if something fails, I issue a message using the Component Controller method issue message


    wd_comp_controller->issue_message( EXPORTING cancel    = 'X'
                                                 mess_text = l_text ).


method ISSUE_MESSAGE .
*   get message manager
  DATA lo_api_controller     TYPE REF TO if_wd_controller.
  DATA lo_message_manager    TYPE REF TO if_wd_message_manager.

  lo_api_controller ?= wd_this->wd_get_api( ).

  CALL METHOD lo_api_controller->get_message_manager
    RECEIVING
      message_manager = lo_message_manager
      .

*   report message
  CALL METHOD lo_message_manager->report_error_message
    EXPORTING
      message_text   = mess_text
      cancel_navigation = cancel.


endmethod.

In my WD, I added a Message Area - this is where my validation messages appear - outside of my form, on my dynpro.

After each validation, I simply


CHECK l_error IS INITIAL.

if it's not initial, processing stops. My form is still rendred on the screen with the appropriate message in the message area.

OttoGold
Active Contributor
0 Kudos

Probably you will do the roundtrip to send the data to the backend. There recognize the type of action and call the proper validation, send the data back to form and notify the user.

But ... well, that is quite awkvard. Too much work with very little result. Maybe you should split your application into two parts? The one with validations as WDA app and a printing one for the form?

Or maybe you can create the webservices for these backend validations, but all this means much work for you.

Maybe you can send some extra data into the form (if you have like 10 plants, send that into the form and validate offline, not in the backend). Well... why don´t you put the available values into DropDowns which would NOT let the user to select a wrong value. You should first think about the design, because it can spare you most of the development time.

Regards, Otto