on 09-09-2008 9:19 AM
Hi All,
In my application, I have to give a set of inputs...and will get the output on the basis of range set. If I dont give any input, then also BAPI will fetch all the data.
I have to set length validations(fixed, maximum) without using simple type.
How this can be achieved ?
Thanks,
Nikhil
Hi Nikhil:
You can put the validation in the "onEnter" event of each input or in the associate event for the save/query action. You have to validate each attribute in your code, the validation itself it´s like any validation of String, number, etc. in Java. To have the messages in the same style that the validations with simple types you should implement this:
msgMgr.reportInvalidContextAttributeException(theNode, wdContext.nodeTheNode().getNodeInfo().getAttribute("attr"),"message to be display in the associated input", true);
Hope it helps you.
Rocío.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rocio, The format which you have given seems to be not working. It looks like (node, attribute info, string, boolean). But when i try that, my WebDynpro shows the invalid format error. It expects(IWDNodeElement element, IWDAttributeInfo attribute, WDNonFatalException ex, boolean cancelNavigation). Does your format work?
Thanks & Regards,
Kavitha.
Kavitha:
My mistake,sorry, it´s the element with wrong validation. The attr is the attr that not pass the validation. Ex.
Client (node)
--> name (attr)
IClientElement client = wdContext.currentClientElement();
msgMgr.reportInvalidContextAttributeException(client, wdContext.nodeClient().getNodeInfo().getAttribute("name"), "Name field must be fill", true);
Hope it helps you.
Rocío.
hi Rocio, It works. But i'm doing the validation for a column in my table. So, i want the red mark to be in the right row (right now, its always in the last row). Also, i want to stop any other actions, navigations etcs when this validation fails even for a single row. How could i achieve this? Here is my code. I have written my code in wdModify view as i felt thats the best place to make the validation work in every instance.
if (wdContext.nodeVn_ContactPersonaDetails().size() > 0) {
for (int size = 0;
size < wdContext.nodeVn_ContactPersonaDetails().size();
size++) {
String attrValue =
wdContext
.nodeVn_ContactPersonaDetails()
.getVn_ContactPersonaDetailsElementAt(size)
.getVa_lastName();
if (attrValue == null) {
IPrivateCreateCustomerInputView
.IVn_ContactPersonaDetailsElement neCnt =
wdContext.currentVn_ContactPersonaDetailsElement();
wdThis
.wdGetAPI()
.getComponent()
.getMessageManager()
.reportInvalidContextAttributeException(
neCnt,
wdContext
.nodeVn_ContactPersonaDetails()
.getNodeInfo()
.getAttribute(
"va_lastName"),
"Last Name field must be filled!",
false);
break;
}
}
Hi Kavita:
IPrivateCreateCustomerInputView.IVn_ContactPersonaDetailsElement theElement =wdContext.nodeVn_ContactPersonaDetails().getVn_ContactPersonaDetailsElementat(the for index);
then validate theElement and show the error useing theElement, if there´s an error break the loop.
If you do this validation is because an event fire a roundtrip so... why don´t you do this validation in the action´s eventhandler?
Good luck!.
Rocío.
Hi Nikhil,
For Example " FileName " is the Context Attribute and if u want to limit it's length to 10 Characters( Max Size ) then Write Code Like below.
if(wdContext.currentContextElement().getFileName().length()>10)
{
wdComponentAPI.getMessageManager().reportWarning("FileName Length should be less than or Equal to 10 Characters");
return;
}
With Regards,
Roop Kumar.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
As for max length validation you can use the property "length" of the InputField.
All other checks must be done manually using code.
Aviad
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
6 | |
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.