Reputation: 3
dojo.byId is not working in xpage js header. Why is this?
<script type="text/javascript">
dojo.require("dijit.form.ComboBox");
function test()
{
alert(dojo.byId("#{id:inputText3}").value);
}
</script>
I am using Xpage head tag. Also I tried this code in JS Script library and it did not work there. It worked for document.getElementById("view:_id1:_id2:inputText3").value . I want to make the code standard. main reason of adding the code in head tag is to make the function modular. Please suggest me if there is any other place I can write my code.
Error - TypeError: dojo.byId("#{id:inputText3}") is null
Upvotes: 0
Views: 1280
Reputation: 21709
Use scriptBlock instead:
<xp:scriptBlock id="scriptBlock1">
<xp:this.value><![CDATA[
dojo.require("dijit.form.ComboBox");
function test() {
alert(dojo.byId("#{id:inputText3}").value);
}
]]></xp:this.value>
</xp:scriptBlock>
Upvotes: 3