Skip to Content

Greying out multiple fileds in one shot?

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

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    Posted on Jul 17, 2011 at 12:01 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

    • 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

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.