on 08-29-2005 11:29 AM
Hi All,
Could someone please tell me how do i go abt displaying an error msg in Dynpro. I have an input field and a button , which when clicked takes me to the next view.
I have created the simple type in association view context.
I have typed the following code and it works,
if(wdContext.currentContextElement().get<my_att_name>().equals("first page or something")wdThis.wdFire<Plug1_name>()elsewdThis.wdFire<Plug2_name>()
but now instead of 2 fire plugs if i want to display an error msg when the input field is blank , how do i do this.I have tried inserting "wdThis.wdGetAPI().getComponent().getMessageManager().raisePendingException()" instead of 1 of the fire plugs but the msg from the msg pool is not called.
Nibu if your there pls help!
thanks
Hi Sunil,
I don't think you can edit the default error message for the simple types. As far as I know SAP doesn't provide any interface or API for doing that.If someone has done that please let us know.
A suggestion is : why don't you use a built in type (integer or string) for your attribute and write your own methods for validation. Thereby you can achieve any kind of validations and can display messages of your own.
Best Regards,
Nibu.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sunil,
Sorry, I don't think I can help you with this. Even I had this problem with the default 0 coming in the input field, but couldn't find any solution for that. And I don't think there is any solution for that.
Best Regards,
Nibu.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi create a method like ..CheckMandatory().
inside that write code like this.
IWDMessageManager messageManager = this.wdThis.wdGetAPI().getComponent().getMessageManager();
IWDAttributeInfo attributeInfo = this.wdContext.getNodeInfo().getAttribute("name");//"name" is a name of the context element that you have.
if (name == null || name.equalsIgnoreCase("")){
messageManager.reportContextAttributeMessage
(this.wdContext.currentContextElement(),
attributeInfo,
IMessageStartView.MISSING_INPUT,
new Object[]{"name"},
true);
Then on click of that button call this method:
public void onActionTest(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActionTest(ServerEvent)
String name = wdThis.wdGetStartViewController().wdGetContext().currentContextElement().getC_name();
this.checkMandatory(name);
wdThis.wdGetAPI().getComponent().getMessageManager().raisePendingException();
wdThis.wdFirePlugToResultView();
//@@end
}
Is it useful or tell me.I'll try to help more.
Regards,
Karthick
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Thanks for that solution Karthick.
And Nibu, this is what i did:
1.set the simple type to 'integer'
2.gave min.inclusive value cuz i did not want it to take -ve values.This in turn made it mandatory to fill the field as it did not accept anythin that wasnt an integer(no coding)
The problems i have now are:
1.I have a default value of'0' entered in the field when I run it...i want the field blank at 1st.Is this possible?
2.Can I change the default error messages that are displayed to make it more user friendly?
thanks
Hi Sunil,
The best solution for this is as you told create a simple type of type buil in type 'int'. Then in the event handler of your input, write the code for checking if it is null(the code I gave in my earlier post).
Hope this helps,
Best Regards,
Nibu.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sunil,
Giving you an example where if an attribute(Associate_ID) is not populated, it will show a message :
if(wdContext.currentContextElement().getAssociate_ID()==null) {
{
IWDMessageManager messageMgr =this.wdComponentAPI.getMessageManager();
IWDAttributeInfo ai=this.wdContext.getNodeInfo().getAttribute("Associate_ID");
messageMgr.reportContextAttributeMessage(this.wdContext.currentContextElement(),ai,IMessage<view component>.ASS__ID,null,true);
}
Hope this helps,
Best Regards,
Nibu.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sunil,
you can create your own messages in message pool of type error or text or warning etc., please go through this link
Regards,
Sirisha.R.S.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sunil,
Try out this link.
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/webdynpro/a simple input form with message and error service support.pdf
its a pdf tat gives u whole description as to how to creat the error mesage and how to use it also.
Regards,
Sirisha.R.S
Hi all,
Thanks so much for all the help.
Now i have 1 more problem,
I have done the validation for the empty field in the way you guys told me.
Now what if I want to also put another validation for this field which allows me to enter only numerals. How do I do this?
I could associate a simple type with built-in type "int" but then i am not able to show any error msg when the field is empty.
thanks
User | Count |
---|---|
94 | |
11 | |
11 | |
10 | |
9 | |
8 | |
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.