on 03-17-2014 11:52 AM
I need to throw an error message if the terms&conditions checkbox is not checked on click of Submit Button in webdynpro java. Can anyone suggest.
The simplest way- write the following code in the action of the Submit button-
if (<radio button not checked>)
{
wdComponentAPI.getMessageManager().reportException("Please accept Terms and Conditions to continue",false);
}
else
{
continueExecution();
}
The exception message will be shown on top of the view.
You may like to use Message Area UI element and place it at the bottom of the WD4J view to show our exception message at the bottom of the view.
I hope this helps !
Cheers,
-Amol Gupta
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
My Apologies. The simplest way- write the following code in the action of the Submit button-
if (<check box not checked>)
{
wdComponentAPI.getMessageManager().reportException("Please accept Terms and Conditions to continue",false);
}
else
{
continueExecution();
}
The exception message will be shown on top of the view.
You may like to use Message Area UI element and place it at the bottom of the WD4J view to show our exception message at the bottom of the view.
I hope this helps !
Cheers,
-Amol Gupta
In WebDynpro Java, the UI is linked to the context. We manipulate(read from / write into) the WDJ ui by manipulating the context.
your check box must be linked to a context attribute of type "boolean". Simply read it in your code. Sample code(needs to be modified according your custom context structure) -
if (wdContext.getCurrentContextElement().getCheckBoxState() == false)
{
wdComponentAPI.getMessageManager().reportException("Please accept Terms and Conditions to continue",false);
}
else
{
continueExecution();
}
//I am assuming that you have a context attribute named CheckBoxState of type boolean bound to your Check box UI element.
Also "wdContext.getCurrentContextElement().getCheckBoxState() == false" - check the correctness of braces by using auto completion as I have written this code manually and not checked it on the NWDS.
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.