2014-10-17 3 views
0

나는 3 개의 라디오 버튼을 가지고 있으며 어떤 라디오 버튼이 추가 처리를 위해 선택되었는지를 알고 싶다. 나는 시도했다.빙상에서 어떤 라디오 버튼이 선택되었는지 식별하는 방법은 무엇입니까?

document.getElementById ("minselected"); document.getElementById ("minselected"). isSelected(); 및

document.getElementByName ("min");

하지만 작동하지 않습니다.

+0

'document.querySelector ('input [type = radio] [name = whatever] : checked')'는 선택된 라디오 입력을 반환합니다. – undefined

+0

서버 측 프레임 워크는 클라이언트 측 JavaScript에 영향을 미치지 않습니다. 두 가지 환경이 있습니다! – undefined

답변

0

icefaces를 사용하는 경우 체크 박스 값을 얻기 위해 자바 스크립트 트위크를 사용하지 않아도됩니다.

ice : selectOneRadio 구성 요소를 사용해보세요.
샘플 코드는 아래와 같습니다 에서 myBean 내 빈 이름
myButtonValue입니다

<ice:selectOneRadio layout="pageDirection" 
    partialSubmit="true" value="#{myBean.myButtonValue}"> 
    <f:selectItem id="1" 
     itemLabel="val1" 
     itemValue="val1" /> 
    <f:selectItem id="2" 
     itemLabel="val2" 
     itemValue="val2" /> 
    <f:selectItem id="3" 
     itemLabel="val3" 
     itemValue="val3" /> </ice:selectOneRadio> 

게터 세터와 콩의 문자열 변수입니다

양식을 제출하면 당신은 얻을 것이다 itemValue 변수의 에있는 myButtonValue