on 11-16-2007 4:54 AM
Hi,
I noticed that in the Employee self-service application, if the user doesnt fill in a mandatory field (let say it's an input field), the application will highlight that input field with the red square line so that the user will be awared of which field data is missing (apart from displaying the error message with MessageManager).
How can i do that in WDP?
Any help would be highly appreciated. Thanks.
- julius
hi,
you can use the following code:
IWDMessage msg = new WDMessage(wdThis.wdGetAPI().getComponent() , "MissingInput", WDMessageType.ERROR , "Enter some Values");
IWDAttributeInfo attrInfo = wdContext.node<Name>().getNodeInfo()
.getAttribute(IPrivate<View name>View.I<Node name>Element.<Attr name>);
if(wdContext.node<node name>().current<node name>Element().get<attr name>() == null){
wdComponentAPI.getMessageManager().reportContextAttributeMessage(wdContext.node<node name>().getCurrentElement(),attrInfo, msg, new Object[] {},false);
wdComponentAPI.getMessageManager().cancelNavigation();
}
The above lines of code you can write on action of Enter for your inputField.
This will surely work.
thanks & regards,
Manoj
Message was edited by:
Manoj
Manoj Kumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
for "if the user doesnt fill in a mandatory field (let say it's an input field), "
Set the state property of the input field to required.
for "the application will highlight that input field with the red square line so that the user will be awared of which field data is missing (apart from displaying the error message with MessageManager"
1) create a validating method
2) Create a message
IWDMessage msg = new WDMessage(wdThis.wdGetAPI().getComponent() , "MissingInput", WDMessageType.ERROR , "<Your Message>");
3) Get the attribute info of the attribute where the redbox should appear.
IWDAttributeInfo attrInfo = wdContext.node<Name>().getNodeInfo()
.getAttribute(<Your Attribute>);
4) Raise the message if your condition violates
wdComponentAPI.getMessageManager().reportContextAttributeMessage(wdContext.node<node name>().getCurrentElement(),attrInfo, msg, new Object[] {},false);
5) Cancel the navigation
wdComponentAPI.getMessageManager().cancelNavigation();
Regards
Ayyapparaj
4)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi julius,
You can use this code
1. Set the propertie of the lable's state field as required.
2. Write the following code in the action
IWDMessageManager messageMgr = wdComponentAPI.getMessageManager();
Object attributeValue =
wdContext.currentDetailElement().getAttributeValue(fieldName);
IWDAttributeInfo attributeInfo =
wdContext.nodeDetail().getNodeInfo().getAttribute(fieldName);
if (attributeValue instanceof String) {
if (((String) attributeValue).length() == 0) {
messageMgr.reportContextAttributeMessage(
wdContext.currentDetailElement(),
attributeInfo,
IMessageForm.MISSING_INPUT,
new Object[] { fieldLabel },
true);
}
} else if (attributeValue instanceof Integer) {
}
3.Raise pending exception.
Regards,
karthik
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.