cancel
Showing results for 
Search instead for 
Did you mean: 

Greying out multiple fileds in one shot?

former_member202077
Participant
0 Kudos

Hello,

I am developing a interactive form (visitor info form) with webdynpro ABAP.

In the initial screen of my_webdynpro, there are couple of radio buttons, US, Europe, Asia.

If user selects US radio button: I have to greyout & readOnly the below 4 input text fields (pls. note these input fields are SCATTERED all around the FORM at different positions, subforms, pages, corners)

 
VISITOR.Page_1.Subform_1.TextField_4.fillColor = "192,192,192"

VISITOR.Page_1.Subform_6.TextField_17.fillColor = "192,192,192"

VISITOR.Page_4.Subform_13.TextField_24.fillColor = "192,192,192"

VISITOR.Page_5.Subform_21.TextField_31.fillColor = "192,192,192" 

If user selects Europe radio button: I have to greyout & readOnly the below 3 input text fields


VISITOR.Page_2.Subform_23.TextField_21.fillColor = "192,192,192"

VISITOR.Page_4.Subform_35.TextField_37.fillColor = "192,192,192"

VISITOR.Page_5.Subform_39.TextField_41.fillColor = "192,192,192" 

I can achive my requirement, by writing the below code at input text field LEVEL


if (this.rawValue == "US")
then
 VISITOR.Page_1.Subform_1.TextField_4.fillColor = "192,192,192"
endif

As its tediuos, code redennecy, I want to do all US stuff (greying out all 4 fields) IN ONE SHOT, pls let me know is there any option for me, i guess GROUPing will not work for me?

Thank you

Accepted Solutions (1)

Accepted Solutions (1)

former_member198445
Participant
0 Kudos

Hi,

First of all, instead of greying out the fields, you could make them Read Only in this way..

TextField1.access = "readOnly";

To make them editable again, you could use

TextField1.access = "open";

As for your current problem, I think there is some amount of code that has to be repeated..

But I have small solution in mind. Maybe it would be useful.

1) Create 3 hidden text fields - one each for the radio button value.. (US, Europe, Asia etc)

2) As soon as the radio button is selected, set the corresponding hidden text field to readOnly or open accordingly..

3) In each of the text fields's 'Calculate' event , write the following script.

this.access = Hiddenfield_US.access;

Regards, Amith

former_member202077
Participant
0 Kudos

Thank you, Sorry, i did not understood your approach (achieving my requirement thru CALCULATE event), pls. eloborate.

Actually, am looking to get avoid CODE REDENNECY, so, i want to get my requirement (setting the 80 fields as Greying or 'readONLY' in ONE SHOT) with one shot

former_member198445
Participant
0 Kudos

From what I know thus far, you will not be able to set the fields at one shot unless they are wrapped into a single sub form.

That way , you could set the single sub form itself as read only, thus rendering the underlying fields as read only.

As for my approach, it may not entirely avoid CODE REDUNDANCY (because of the repetitive code in each field's calculate event), but it would certainly reduce the number of lines of code.

Regards, Amith

Answers (0)