cancel
Showing results for 
Search instead for 
Did you mean: 

Need Java Scripting to raise an error in adobe form

Former Member
0 Kudos
329

Hi,

I have a radio button group in that i have three radio buttons, by default no radio button is selected, when i execute the adobe form in portal the system should not allow me to proceed further until and unless i select any radio button. I made the radio button group property to user entered required and i have written some error message in the error tab, but this error is not triggering, do i need to write any java script if so in which event i need to write and what is the script. Any help will be greatly appreciated.

Regards,

Venkat.

View Entire Topic
vaibhav_tiwari
Contributor
0 Kudos

Hi Venkat,

Have you any submit button or any other event trigger UI element to execute the form. If yes then write the following script in the click event:

if( RadioButtonList.rawValue == ' ' )
    xfa.host.messageBox("Choose any Radio Button");
else
    app.eval("event.target.SAPSubmit();");

here in the else condition i have used the default code written at the click event of a web dynpro activeX submit button. If you are using the same button then the code is perfect for you else change the else condition code according to the requirement.

Hope it will be helpful.

Regards,

Vaibhav Tiwari.

krishanu_biswas
Advisor
Advisor
0 Kudos

Hello Vaibhab,

Your JS code looks absolutely fine. But, this was something that i always try to avoid. Imagine if you have 10 forms and you have the same logic to be implemented in 20 diferent event handlers, maintaining all of them over the time would become a nightmare. Instead, write your validation logic in one place in your application on the server and let all the client side events make use of it. Tommorow, if you have change in your logic, you would only do the changes in one place instead of doing it in all 10 different forms. What goes agaist with my proposal is that you end up making some server requests everytime you submit a form. But, this would be perfectly aligned with the Web Dynpro philosophy wherein every request is a server request and you do not have any provision to write any client side JavaScript in Web Dynpro. I would recommend to go for JavaScript only when you absolutely need to write it.

Best Regards,

Krish

vaibhav_tiwari
Contributor
0 Kudos

Hi Krishanu,

Thanks for sharing your knowledge. It seems useful.

Regards,

Vaibhav Tiwari.