on 08-13-2008 12:06 PM
Hi all,
I have a typical requirement...
I have an input field Material Number.
When i enter an invalid Material Number (e.g: 12345)
I should get an error message which displays:
"Material 12345 does not exist" .
How do i tag the input field data to the error message??
Please help.....
Using Message Pool:
1) Open Message Pool, Add Message
2) Create a Key (say: INVLD_MTRL ), make it to Warning
3) Add Message as : Material does not exists.
4) save.
5) Open view where you are getting material number, and in onAction of validation, you can use the condition
sample:
String mat_num = wdContext.currrentContextElement().getMaterialNumber();
if(wdContext.currrentContextElement().getMaterialNumber() == 12345) {
wdComponentAPI.getMessageManager().reportMessage(
IMessageTestapp.INVLD__MTRL, new Object[mat_num] {}, true);
}
nikhil
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 value attribute of type Integer ( MaterialNo ) Bind it with input field, on action of input field put this code and deploy.
Could you elaborate the criteria for invalid material no, that has to be coed in if block.
if( wdContext.currentContextElement().getMaterialNo() == 12345)
{
wdComponentAPI.getMessageManager().reportException( " Material No " +
wdContext.currentContextElement().getMaterialNo() + " does not exists", true);
}
Regards
Vinod V
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
you want bind/tag error msg with the input field. for that you need to use message pool.
In the message pool you need to define the error key with the error message.
As you know to display the error we used to code like:-
wdComponentApi.getMessageManager.ReportException(<msg>,true);
this will also display message but if you click/select the error Message it will not bind/tag with the respective input field for this you have to code like that:-
Read the attribute info for the Input UI context attribute:-IWDAttributeInfo info = wdContext.nodeEventInformation().getNodeInfo().getAttribute(<attibutename>);
IWDMessageManager messageManager = wdComponentAPI.getMessageManager();
messageManager.reportContextAttributeMessage(
<current context where attribute palced>,info, IMessageEventsComponent.EVENTTITLE(message pool key),new Object[] { },true);
This code will tag the error with input UI.
Hope this may help you.
Deepak
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
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.