cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with the using of the DropDownByKey

Former Member
0 Kudos

Hello Experts,

I've just created a Tab where Data can Edit.

It looks like a formular > see the following lines:

Activity_1---->DropdownMenu--->InputField---->RadioButton

Activity_2---->DropdownMenu--->InputField---->RadioButton

I've create a Context for the DropdownMenu filled with "Symple Types"

The DropDownByKey includes three things to choose (e.g. allowed, not allowed, no idea).

Before choosing one of them I want the InputField and the RadioButtons Disabled. When I choose allowed, I want the InputField and the RadioButton get Enable.

I hope for help.

Thanks a lot

Best regards

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Create a boolean context attribute named for example "readOnly" and bind the equally named property of the input field and the radio button to this attribute. In wdDoInit(), set the attribute value to "true".

This will make the input field and the radio button read-only initially.

Assign an action to the DropDownByKey.onSelect event.

Assuming the "selectedKey" property of the DropDownByKey element is bound to a context attribute named "selectedKey", implement the action handler like


void on<ActionName>Action(...)
{
  String selectedKey = wdContext.currentContextElement().getSelectedKey();
  if ( "allowed".equals(selectedKey) )
    wdContext.currentContextElement().setReadOnly(false);
}

Take care to compare the context attribute value to the key of the type enumeration, not to the descriptive text!

Armin

Edited by: Armin Reichert on Apr 17, 2008 10:12 AM

Former Member
0 Kudos

Dear Armin,

thank you for your post, but can you describe me the prozedure step by step. Maybe in german?

Thanks

Marcus

Former Member
0 Kudos

Come on. I think the description above should be clear enough. Where exactly do you still have problems?

Armin

Former Member
0 Kudos

I don't know, where I have to bind the inputfield and the radiobutton.

So far, I have one context with type (path to the Symple Type")

so the context includes the allowed, not allowed, no idea).

Should I create another seperate Context with type (boolean)?

I don't know, where and how I have to bind the inputfield and the radiobutton.

Thank you

former_member201361
Active Contributor
0 Kudos

hi ,

u can create a context Attribute in the view

eg:

Context Attribute be "input"

and type is Boolean. and bind the readonly property of the Inputfield and radio button to the Attribute "input".

in the Doinit method .

set the Attribute Value to be true.

wdContext.CurrentContextElement.setInput(true);

in the domodify method use the if condition as told by armin

and as per ur requirement make the property of the Attribute to false if the drop down by key , selected vale is allowed.

wdContext.current.setInput(false);

thanks and regards

fistae

former_member201361
Active Contributor
0 Kudos

hi ,

Right click on the Context of the View and create a new Attribute as input.and select the type as boolean.

now go the view Layout , here u bind the readonly property of the input field and the radio button to the boolean attribute input.

thanks and regards

fistae

Former Member
0 Kudos

Thank you,

I've have one more problem.

I did what you said, but there is the mistake when I take the code below "the method getSelectedKey() is undefined for the type IPrivat....IContextElement"

Assuming the "selectedKey" property of the DropDownByKey element is bound to a context attribute named "selectedKey", implement the action handler like

void on<ActionName>Action(...)

{

String selectedKey = wdContext.currentContextElement().getSelectedKey();

if ( "allowed".equals(selectedKey) )

wdContext.currentContextElement().setReadOnly(false);

}

What I have to do in the wdModify???

Thank you

Marcus

Former Member
0 Kudos

I resolved my problem with the get method.

But it didn't work.

I can choose Allowed, but the readOnly is already active

Hope for help

former_member201361
Active Contributor
0 Kudos

hi, have u used the coditional statement for checking the selected key and

make the boolean attribute to false.

wdContext,currentContextElement.seturBooleanAttribute(false);

thanks and regards

fistae

Former Member
0 Kudos

Thank you all. I resolved the problem.

The property-field enable of InputField and RadioButton was set on false.

Thank you all

Former Member
0 Kudos

Where did I say "in wdDoModifyView()"?

Armin

Former Member
0 Kudos

Dear Armin

This wasn't from you.

in the domodify method use the if condition as told by armin

and as per ur requirement make the property of the Attribute to false if the drop down by key , selected vale is allowed.

wdContext.current.setInput(false);

But thanks for your help

Marcus

former_member201361
Active Contributor
0 Kudos

hi,

I am sorry Armin . it was my mistake.instead of OnAction method , i wrote it as domodify method .

regards

Fistae

Former Member
0 Kudos

I have another question to my first problem. Because I have several activities, to such an input field and radio button item follows, I will make it so that for each activity, independent from th others, I can choose one of the three things (Allowed, ...). Do I have to create a context attribute for each activity? or how do I realize?

Later I will store it in a database and want to display the information in a next view.

Thanks for the help

Former Member
0 Kudos

I don't understand the question. Could you please open a new thread and give some more details?

Armin

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

As mentioned by you,you have created a simple type to bind it to dropdown key.So for instance you created simple type with following enumeration:

Value Description

a. AL Allowed

b. NA Not Allowed

c. NI NoIdea

To fullfill your requirement,create a boolean context and bind it to your input field and radio button.

Now Go to your layout of dropdown by key and you will find a event on Select.Create a event for it and inside that event write the following piece of code..

In the Action OnActionSelectDropDown()

{

String selectedKey = wdContext.current<Node>Element().get<AttrBindedtoDD>;

if(selectedKey .equalsIgnorecase("AL"))

{

// Make the boolean context as true

}

else{

// Make the boolean context as false

}

}

Hope this will resolve your problem.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Regards,

Amit Bagati

Edited by: Amit Bagati on Apr 16, 2008 5:24 PM

Edited by: Armin Reichert on Apr 16, 2008 8:04 PM

venkatakalyan_karanam
Active Contributor
0 Kudos

Hi

The dropdown by key contains 3 values at run time.Take one more context attr of type boolean and bind with the property readOnly of InputField and RadioButton.Assign an Action to the DropDownByKey.

In the Init method disable the InptField means setting the attr to either true or false.Which binded to readOnly property.

In the Action OnActionSelectDropDown()

{

String keySele = wdContext.current<Node>Element().get<AttrBindedtoDD>;

if(keySele.trim().equalsIgnorecase("Allowed"))

{

//enable or disable the inputfield

}

else{

//enable or disable the inputfield

}

}

Regards

Kalyan

former_member201361
Active Contributor
0 Kudos

hi ,

Initialy make the input field and radio button to readonly .

if the user selects the dropdownBykey as "Allowed"

in the method u have to check for the possible selction.

let say the attribute name is drop in the context of the view

ie if(wdContext.currentNodeElement.getdrop().equals("allowed")){

set the readonly property to false for the radio button and inputfield.

}

hope ur problem get resolved

thankd and regards

fistae