on 11-22-2006 4:31 PM
Hi all,
I'm trying to make a mandatory field check but in the message triggered I want to use the attribute "Text" of the label of my inputfield:
//This is my inputfield's label
IWDLabel Dt_Decrichiesta = (IWDLabel) view.getElement("Dt_Decrichiesta_Label");
//This is my check method with 2 parameters: 1 is the field to check, 2 is the name of field to use in the error message
wdThis.CheckMandatory(IPrivateCompRequestView.IX_Zur_RichiesteElement.DT__DECRICHIESTA,Dt_Decrichiesta.getText());
everything is done in the action handler.
As u can see I need a IWDView object to call the getElement method...
Where/how can I get that???
You can get WDView object only from wdDoModifyView method.
This variable arrive you from standard call.
Look parameter of wdDoModifyView
-
public static void wdDoModifyView(IPrivateAsd wdThis, IPrivateAsd.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)
Message was edited by:
Roberto Tagliento
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
ok, that's it...
according to SAP specifications and raccomandations up to now you cannot get a view handler anywhere else than in wddomodifyview.
tanks to everybody
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Why can't ypu do this through ContextProgramming ?
I mean you can bind Text property, State property to respective contexts.
Read this context in your method (so that you don't require IWDView).
Regards, Anilkumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Can't you try with a static variable of type iWDView and initialise it inside the WD view
Regards
Ayyapparaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok, I know that in the wddomodifyview I have the variable view as import parameter but the problem is that my code is implemented in the action handler and not in the wddomodifyview.
I need a way to get such reference in any other place such as wddoinit or anywhere else than wddomodifyview...
is it possible?
If no, which is the better way to pass the reference from the wddomodifyview to another method?
Regards,
Stefano Cattaneo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Look:
public static void wdDoModifyView(IPrivateAsd wdThis, IPrivateAsd.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)
there is boolean firstTime.
Do your check mandatory field into wdDoModifyView, this method is called always and use firstTime for skip the control at first presentation of the view!
I've tryed your solution but I still have a problem:
in "public void onActionSave" that is my button's action handler I have to save the data from the screen to the DB, this mean that I have to check them first.
The method "public static void wdDoModifyView" is called after "public void onActionSave" so it is too late!
...still need help
Stefano Cattaneo
What do u mean with:
> The 2 operation are binded on functionality but are
> practical separated on developing.
...in any case I have tryed to do what u say but when I press the button "Save" the system trigger the action and execute the corresponding method "onActionSave".
After that it execute the method "wddomodifyview" and perform the check exposing the error message.
Where I am wrong?
Thank u again and again...
Stefano
😛
sorry i am criptical
by the way into method "onActionSave" {
if (checkMandatory_is_OK()) {
// DO WHAT TO HAVE TO DO
}
// ELSE DO NOTHING/IGNORE THE click THAT USER HAVE DONE
}
and into
"wddomodifyview" {
if (!checkMandatory_is_OK() && !firstTime) {
// SHOW MESSAGE ERROR
}
}
forgot "firstTime"
Message was edited by:
Roberto Tagliento
If i guess right...
For more look here:
https://www.sdn.sap.com/irj/sdn/downloaditem?rid=/library/uuid/28a7bed1-0401-0010-d181-f0d3292eab7e
https://www.sdn.sap.com/irj/sdn/downloaditem?rid=/library/uuid/0c0dcacd-0401-0010-b4bd-a05a0b4d68c8
https://www.sdn.sap.com/irj/sdn/downloaditem?rid=/library/uuid/1aaae990-0201-0010-49a7-cc792a943ba1
and this very good blog
/people/valery.silaev/blog/2006/03/10/minus-evs-plus-ovs-value-help-smart-input
Hi Roberto,
maybe I have understood... I will try this but...
you suggest to make the checks in the eventhandler and delegate the showing of message in the wddomodifyview, but in this way I can't know what fields has raised the error. Of course I can export that info and pass it but it doesn't seem convenient, I can also perform the checks again in the "wddomodifyview" but it's not convenient too...
I only need a handler for the view to get the attribute of the view element.
Don't u agree?
Hi,
You can do this:
In the <i>//@@begin others</i> section, declare a field like this:
static IWDView thisView = null;
Then in wdDoModifyView, assign like this:
if(firstTime)
thisView = view;
Then in your event handler methods you can access this view reference simply as <i>thisView</i>.
Regards,
Satyajit.
hi,
its available in wdDomodifyview() as an input parameter,
LM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
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.