on 03-27-2008 7:55 AM
Hi,
I have made one input field as required field in a view.
I want to display one custom error message ,if the required input field is not entered.
Please help me regarding this.
Thanks,
Deepika
Hi ,
If your input field is mapped to a value attribute , name.
validating name as required field
if(wdcontext.currentcontextelement.getName().length >0)
{
}
else
{
wdcomponentAPI.getMessageManager().reportException("Enter Name");
}
Regards,
Sunitha Hari
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
just follow these steps
1. Open message pool and add a message (i.e. custom message what ever u want) and enter appropriate message key & message type
2. write the following code in the button action function
IWDMessageManager messageMgr = wdComponentAPI.getMessageManager();
if(wdContext.currentContextElement.getfieldName()==null){
messageMgr.reportContextAttributeMessage(
wdContext.currentContextElement(),
attributeInfo,
IMessagecomponentName.MessagePoolKey,
new Object[] { "" },
true);
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Deepika,
Try this code
if( wdContext.currentContextElement().getFldValue() == null)
{
wdComponentAPI.getMessageManager().reportSucessMessage( "String - sucess");
}else
{
wdComponentAPI.getMessageManager().reportErrorMessage( "String - error");
}
Regards
- Vinod
*
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
declare the error or warning or text messages in the message pool.
we can use those message in the view using the message manager .
IWDMessageManager messageMgr = wdComponentAPI.getMessageManager();
and check if the input field or any other ui element is null then throw error messages.
if(wdContext.currentContextElement.getfieldName()==null){
messageMgr.reportContextAttributeMessage(wdContext.currentContextElement(),attributeInfo,IMessageSimpleComp.EMAIL,null,true);
here email is the required field.
hop your problem get resolved.
thanks and regards
fazal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi deepika....
First go to message pool under webdynpro components.
Create a new message there..of type error.
Enter your text.
Now to avoid null pointer exception , in wdDoInit(), initialise the value
wdContext.currentDateTimeElement().setDate("");
now create an action for submission of data. If field is empty, then within the button write:
msg = wdComponentAPI.getComponent().getMessageManager();
if(wdContext.currentDateTimeElement().getDate().equals(""))
{
msg.raiseMessage(IMessageCompTodatDateTime.ERROR,new Object[]{""},true) ;
}
between begin others put:
regards,
pinki
IWDMessageManager msg = null;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Dipika,
U can do this through " Message Poll" which is availabel at Controller tree.
Double click on Message Poll new wendow will apear then at left most side there will be one button for creating message according to your need.
Regards,
Gurprti Bhatia
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Refer to this document - [Webdynpro messages|http://help.sap.com/saphelp_nw04/helpdata/en/72/1d6526263ff24995016a152705eab2/frameset.htm]
Regards
Srikanth KV
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.