선택한 항목을 목록, 콤보 상자 등으로 가져 오는 방법은 무엇입니까? 목록 상자에서 선택한 값 가져 오기?
나는 코드 here의이 비트 발견/*****
*** getSelectableValues()
*** prints all selectable values for a given component, f.e. comboboxes, listboxes etc.
***
*** @params id of component
*****/
function getSelectableValues(id) {
var ComboBox = getComponent(id);
var ChildrenList:java.util.ListIterator;
ChildrenList = ComboBox.getChildren().listIterator();
while (ChildrenList.hasNext()) {
var Child = ChildrenList.next();
/*** process computed/multiple values ***/
if(typeof(Child) == 'com.ibm.xsp.component.UISelectItemsEx'){
var hlp = Child.getValue();
for(var i=0; i< hlp.length; i++){
/*** print to server console ***/
print(hlp[i].getLabel() + "|" + hlp[i].getValue());
}
}
/*** process single values ***/
if(typeof(Child) == 'com.ibm.xsp.component.UISelectItemEx'){
/*** print to server console ***/
print(Child.getItemLabel() + "|" + Child.getItemValue());
}
}
}
/*** get all selectable values for element 'comboBox1' ***/
getSelectableValues('comboBox1');
를하지만 목록 상자에서 모든 항목뿐 아니라 선택한 사람을 얻을 것으로 보인다. 모든 아이디어를 수정하여 선택한 값만 가져 오는 방법은 무엇입니까?
감사합니다. 트릭을 한 것은 @explode라고 생각합니다. –