cancel
Showing results for 
Search instead for 
Did you mean: 

DropDownKey and PopUp Window application

Former Member
0 Kudos

Hi

I have application in which there two UI Elements, namely DropDownByKey and Input Field.

I have to restrict the user from entering any data in input field without selecting anything in DropDownByKey. and if he does he would get a pop-up message regarding that.

and one more question, how do we access the properties of any UIElement like the Visibility, Enablity etc..

Thanks in advance

Srikant

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Srikant,

1) In Java you can have your own key listeners & mouse listners defined which you can associate with an inputfield. So whenever the user is trying to enter some data into the input field, we can capture that event and decide the flow of control accordingly.

2) In WebDynpro we do not have such listeners defined. We cannot define our own listeners and associate them to a UI element. Instead we are forced to use only those listeners already defined by SAP. And for input field SAP has defined only one such listener - 'onEnter'. So there is no means to triiger an event when the user starts to enter some data into an input field.

Therefore, to achieve your functionality the best way is to follow what Armin has suggested.

Hope this helps,

Best Regards,

Nibu.

Former Member
0 Kudos

hi nibu and armin,

Instead of dialog box can we use the message editor?

is there anyway we can do that here.

Thanks in advance

Srikant

Former Member
0 Kudos

You can use the IWDMessageManager API to create messages.

But in your scenario, I cannot see when you would create a message like "Select an item first". I would suggest to add an appropriate label to the drop-down list and a tooltip on the input field that explains why it is read-only.

Armin

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Srikant,

<b>" I have to restrict the user from entering any data in input field without selecting anything in DropDownByKey. and if he does he would get a pop-up message regarding that. "</b>

Sorry Srikant, as far as I know this functionality is not possible. InputField has only one action associated with it - 'onEnter'. It doesnot have any other listener through which we can know if the focus is on the inputfield. So as Armin told, the only way we can restrict the user is by disabling the inputfield. And if disabled, obviously the user cannot enter anything. So there is no scope for showing the pop-up message.

If webdynpro supported key listeners, then we could have achieved this functionality of showing the pop-up and not disabling the field.

Best Regards,

Nibu.

Former Member
0 Kudos

hi Nibu,

thanks for the suggestion. I want to re phrase it and put it.

There are two UI Elements:

1.DropDownByKey

2.InputField.

My requirement is unless i don't choose a value in DropDownByKey i should not be allowed to type in InputField and instead "CONFIRMATION DIALOG" will come and the dialog box should say "pick a value". So unless i don't do it should not allow me write anything in input field

is there any solution

Thanks in advance

Srikant

Former Member
0 Kudos

I already sketched the solution in my earlier post, let me give some more details:

1. Reserve one key/value pair in the DDL (drop-down list) for the "nothing selected" case.

2. Bind the InputField.readOnly property to a boolean context attribute "inputReadOnly" and initialize this with TRUE.

3. Create an action "ItemSelected" and bind the DDL.onSelect event to that action.

4. In the action handler method, check if a "real" item has been selected and set "inputReadOnly" to FALSE in this case. This will make the input field editable.

I still don't like the idea of showing a popup window as an indicator that nothing has been selected.

Perhaps you could use a tooltip on the InputField to indicate why it is read-only.

Armin

Message was edited by: Armin Reichert

Former Member
0 Kudos

Hi Srikant,

Why do you want popup message in this case ?

As suggested by Armin you can make the inputfield readonly true or false depending upon the combo selection.

For accessing the properties of any UIElement , you bind the attribute to context and you can always change the value of the contextAttrib to change the corresponding proprty of the UIElement.

Regards, Anilkumar

Former Member
0 Kudos

Hi Srikant,

1) Armin has given you the solution.

2) You can access the view elements in your wdDoModifyView() as

IWDViewElement elmt = view.getElement("<ID of your view element>");

You can then type cast that to the corresponding element and set the desired property.

IWDInputField field = (IWDInputField)elmt;
field.set<property>(<value>);

Hope this helps,

Best Regards,

Nibu.

Former Member
0 Kudos

hi Nibu,

U rock always ready with answers. and yeah Armin answer solves the problem in a different way but still i want the pop window to come up and give message

Is there any way to do it

Thanks in advance

Srikant

Former Member
0 Kudos

Don't use wdDoModifyView() to set property values, use data binding instead.

Armin

Former Member
0 Kudos

Hi

Try this link it may help you in creating popup windows

http://help.sap.com/saphelp_nw04/helpdata/en/55/084640c0e56913e10000000a1550b0/frameset.htm

suresh

Former Member
0 Kudos

You can control editing the InputField using its "readOnly" property (or the "enabled" property).

To do so, create an attribute (boolean) in the view context, bind the InputField.readOnly property to this attribute. Set the value of the attribute as desired.

Check the selection in the drop-down list using the "onSelect" event and an associated action. In the action handler, you can set the context attribute that controls the InputField.

I would not use a popup in this case.

Armin