jsfのinputタグなどをJavaScriptで制御する。

<h:view>
  <h:form id="form1">
    <h:inputText id="userId" />
  </h:form>
</h:view>

と、すると、inputタグは"form1:userId"というid(nameだったかも)になる。
ここで、

document.form1.form1:userId.value = "hoge";

としてもJavaScriptエラーとなる。


ので、

document.getElementById("form1:userId").value = "hoge";

や、

document.all['form1:userId'].value = 'hoge';

とする。