cancel
Showing results for 
Search instead for 
Did you mean: 

problems with parameter mapping

Former Member
0 Kudos

Hello,

i have the following situation:

- action "GetSelected" with parameter "a_checked" type boolean and parameter "a_index" type integer (also at the event handler method onActionGetSelected)

- ui element: type "CheckBoxGroup", texts to a multi selection value node, id "CheckBoxGroup", action "GetSelected"

- coding of method onActionGetSelected

  msg.reportSuccess("a_checked:".concat(String.valueOf(a_checked)));
  msg.reportSuccess("a_index".concat(String.valueOf(a_index)));

- coding of method wdDoModifyView (i got it from the documentation/help)

 if (firstTime) {
    // Get a reference to the checkbox UI element
    IWDCheckBox cb = (IWDCheckBox)view.getElement("checkBoxGroup");
    // Link the client-side event parameter ‘checked’ to the server-side action parameter ‘a_checked’ & ‘a_index’
    cb.mappingOfOnToggle().addSourceMapping("checked","a_checked");
    cb.mappingOfOnToggle().addSourceMapping("index","a_index");
  }

What I want to do is, to find out the index of the selected checkBox. But it doesn't work. I always got a nullpointerexception for the line

 cb.mappingOfOnToggle().addSourceMapping("checked","a_checked");

Can anybody help me please? What did i wrong? I use the developer studio 2.0.10.

Best regards

Petra

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Several remarks:

- UI element ID's are case-sensitive, if your checkbox group has ID "CheckBoxGroup" you must write view.getElement("CheckBoxGroup")

- In your code, you cast to IWDCheckBox. This should be a cast to IWDCheckBoxGroup

- Style: Instead of "a_checked:".concat(...) You can simple write "a_checked:" + a_checked

Armin