on 03-21-2007 5:30 AM
Hi All,
I have a general checkMandatory function which is working fine wiht current InputFields on view.
Now, When I add another row of input fields on that form I want them also to be checked through checkMandatory function.
How can I perform this as I want them to be checked only at the click of button.
Can I iterate through all UI elements in OnAction and then do something?
Please guide!
please reply soon1
Sumit
Hi,
Add this code in your Action method.
this.checkMandatory("Please enter Order ","Search_Term");
wdThis.wdGetAPI().getComponent().getMessageManager().raisePendingException();
// test for another input field
this.checkMandatory("Please enter Status ","Search_Status");
wdThis.wdGetAPI().getComponent().getMessageManager().raisePendingException();
And this context field(Search_Status) is avail in currentContext only.
Then it should work.
Other post if any issues.
thanks,
Lohi.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Actually I have some inputfield sin a row.
On click of Addrow button another row is entered. All these inputfields are mandatory.
So when new fields are added how can i use check mandatory with them using:
this.checkMandatory("Please enter Status ","Search_Status");
wdThis.wdGetAPI().getComponent().getMessageManager().raisePendingException();
Because this code is to be written in OnAction of Submit button.
Please guide !
Sumit
Hi Sumit,
It seems that you are dynamically adding the input field in WDDoModify.
If I am right then the way you are checking the mandatoryness for the existing fields you can also do it for the dynamically generated one too.
you can check this tutorial havin the similar kind of mandatory function in it you can slighty modify it to make it genric so that the function is called also for the new fields generated at runtime, the tutorial is given below:
<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webdynpro/a%20simple%20input%20form%20with%20message%20and%20error%20service%20support.pdf">Link</a>
Regards
Sid
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
This is my checkMandatory code:
public void checkMandatory( java.lang.String displayName, java.lang.String fieldContextID )
{
//@@begin checkMandatory()
IWDMessageManager messageMgr =wdThis.wdGetAPI().getComponent().getMessageManager();
String attributeValue = wdContext.currentContextElement().getAttributeAsText(fieldContextID);
IWDAttributeInfo attributeInfo =wdContext.getNodeInfo().getAttribute(fieldContextID);
if (attributeValue != null)
attributeValue = attributeValue.trim();
if (attributeValue.length() == 0) {
//String fieldLabel = this.wdContext.getNodeInfo().getAttribute(displayName).getSimpleType().getFieldLabel();
messageMgr.reportContextAttributeMessage(wdContext.currentContextElement(),attributeInfo,
IMessagePoInvoice.EMPTY__INPUT,
new Object[] { displayName },
true);
I have also done the simple types thing. It is not working. Do I have to change any other property.
Can't I do it by iterating through all elements and then checking for mandatory Inputfields and calling checkMandatory function for them.
please reply soon!
Sumit
Sumit,
The code looks ok. Describe your context structure and provide calls to checkMandatory method -- probably you are using wrong letter case for attribute names or similar.
Btw, "not working" means "no messages on UI" or it means "exception thrown"?
Valery Silaev
SaM Solutions
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.