cancel
Showing results for 
Search instead for 
Did you mean: 

SAP Cloud SDK : Enable disable Textbox based on Radiobutton

Former Member
0 Kudos

Hi Experts,

We have developed the embed component as shown below.

Now we have requirement to enable / disable or Visible true /false Inputbox based on Radio button.

How i can achieve this.

Initially both inputbox disable by default.

My requirement is when user click on Radiobutton "InputBox 1" the Inputbox 1 enable for input.

and when click on radiobutton "Inputbox 2" Inputbox 2 enable for input and Inputbox 1 disable.

Anyone have idea how to achieve it.

Regards,

Mithun

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Use UI Scripting.

1. Bind the radio button to a field containing a code list

2. Set the "enabled"-property of the input fields to "Advanced" and select a calculation rule

3. As invalidation trigger (lower part of the dialog) select the field bound to the radio buttons

4. as calculation rule, use something like this:


if $data.radiobutton == "InputBox_1"

  result = true

else

result = false

end

with $data.radiobutton being the field bound to the radio button and "InputBox_1" being the code value for the selected radio button

Best regards,

Ludger

Former Member
0 Kudos

Hi Ludger,

To make radiobutton i have followed the below steps :

1) Create custom business object with below elements

2) I have created the Code List Data Type and used under the 1 of the element as a data type as shown above.

3) Now I have created the screen for this business object and open QA in UI designer.

4) Drag and Drop the RadiobuttonGroup from Toolbar and open DataModel tab and in Left section select Radiobutton element and on Right section select the element from BO Model that assigned the data type Code List Data type as shown in above figure ( DropDown).

5) Now Open UI Designer and Select RadiobuttonGroup and open properties windows and change the properties Behavior --> Enabled and select "Advance" option from list. Once the Pop-up open i have follow the below steps

-> Select Calculation Rule radiobutton

-> go to Invalidation Trigger option at bottom and select Radiobutton element from left section and click on move button or move to Right section.

-> Now for code go to Calculation Rule and i have implemented the below code for testing

6) But when i save and activate it and open screen i am getting below result Radiobutton group grayed out.

Kindly help me what is wrong in the above steps.

Regards,

Mithun

Former Member
0 Kudos

First a question:

which data field is the radio button itself bound to:

/Root/DropDown or /Root/RadioButtonGroup/DropDown?

1. Please set the enabled property on the inputboxes, not on the radiobuttongroup

2. Use this code for the enabled property on the inputbox 1:


if $data.DropDown == "V_1"

  result = true

else

  result = false

end

This code assumes the radiobutton is bound to /Root/DropDown, which I am not sure whether this is the case, from your example this is not clear.

If the radiobutton is bound to /Root/RadioButton/DropDown, replace the content in the if-clause and the invalidation trigger by that one.

Best regards,

Ludger

Former Member
0 Kudos

Hi Ludger,

Its working....

Can you help me 1 thing

If i am select Radiobutton 1 then i can able to make it enable true for InputBox1 and enter the value in it

Now when i select Radiobutton 2 then InputBox1 should be clear and no value in it and enable true for InputBox2 and able to enter value in it.

So Clear InputBox value from radiobutton do you have idea how to do that.

Regards,

Mithun

Former Member
0 Kudos

To achieve this, you need to go to the radiobutton data field properties and add an event handler in the Events -> OnValueChanged section.

Use this Eventhandler to conditionally clear all fields required depending on the value of the radiobutton data field.

best regards,

Ludger

former_member200889
Participant
0 Kudos

Hi Ludger,

I try do, but no effect

I want setting inditor field IndAccUser is checked,

the field IndEMS is visible

bseg regards.

former_member200889
Participant
0 Kudos

Following code is valid

if ( $data.IndAccUser == true )

  result = true

else

  result = false

end

Answers (0)