cancel
Showing results for 
Search instead for 
Did you mean: 

Disabling one input field while entering text in other input field

Former Member
0 Kudos

Hi,

I am new to WebDynpro. My problem is very simple. I have two input fields. When i enter text in one input field i want the second input field to be disabled & Vice versa. The idea is that i want to give the user the option to enter text in only 1 input field of his choice. When, he chooses one field, the second input field should automatically get disabled. He can choose only one input field of his choice. The second one should get disabled.

Eg: Assume that there are two input fields "Item No" & "Material". The user should be able to do a search using any one of these parameters, but not both. So, when he chooses to do a search based on "Item No", the "Material" input field should be disabled (greyed out)once he enters text in the "Item No" field. And, vice versa. The choice of field is up to the user.

I guess it is a very elementary doubt. I went through many discussions, but since i am new to WebDynpro, I could not find a 100% satisfactory answer. Would appreciate if some explained the steps right from the beginning, instead of redirecting me to some other discussion. (Please include code as well, if any).

Kindly help.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

This is not possible because there is no "onFocus" event on the input field.

But you could use two radio buttons R1, R2 to enable exactly one of the input fields F1, F2 at a time.

In the view designer, set R1.keyToSelect = "1", R2.keyToSelect = "2".

Bind R1.selectedKey and R2.selectedKey to a common context attribute A (type string).

If (at runtime) A contains "1", radio button R1 is selected, if A contains "2", radio button R2 is selected.

To enable input field F1 exactly if R1 is selected:

Create a calculated boolean attribute E1 that returns the boolean value ("1".equals(A)), bind property F1.enabled to E1. Do the same for F2.

Armin

Answers (2)

Answers (2)

Former Member
0 Kudos

Thanks guys... It worked fine...

Thanks a tonne

Former Member
0 Kudos

Hi,

I would suggest using the radio buttons just to denote the type of data the user is entering and having only one input field. Then use the date from the input field based on the radio button type the user selected.

Cindy

Former Member
0 Kudos

I would do this only if the type entered is the same for both input fields. Otherwise you loose the data type specific behaviour like value help or date picker.

Armin