Hai everybody, this is the proplem.when i excute the page and on clicking the button am getting error message saying that 'menu1.value is null or not an object'. how can i handle it.Please help me

<SCRIPT type="text/javascript">

function test1(form) {
if (form.menu1.Value == "Select")
alert("Please select some other value!")
else {
alert("Hi "+form.menu1.value+"! Form input ok!");
}
}
</SCRIPT>
..
..
..(and in the <body>)
..
<h:selectOneMenu styleClass="selectOneMenu" id="menu1" value="Select">
    <f:selectItem itemValue="Select"  itemLabel="select"/>
    <f:selectItem itemValue="Value1" itemLabel="SAC" />
</h:selectOneMenu>
<TD><hx:commandExButton type="submit" value="Submit" styleClass="commandExButton"  id="button1" onclick="return test1(this.form);"></hx:commandExButton>

Is that supposed to be html or xml?

this code is a part of JSF page... and includes HTML tag

- You have "Value" at one point, and "value" at another point. JS is case-sensitive.

Well thats a typo mistake..
Anyhow i solved it. thanks for ur reply! i have done the changes i made .
<SCRIPT type="text/javascript">

function test1(frm) {
if (document.getElementById('Form1.menu1').Value == "Select")
alert("Please select some other value!")
else {
alert("Hi Form input ok!");
}
}
</SCRIPT>
..
..
..(and in the <body>)
..
<h:selectOneMenu styleClass="selectOneMenu" id="menu1" Value="Select">
<f:selectItem itemValue="Select" itemLabel="select"/>
<f:selectItem itemValue="Value1" itemLabel="SAC" />
</h:selectOneMenu>
<TD><hx:commandExButton type="submit" value="Submit" styleClass="commandExButton" id="button1" onclick="return test1(this);"></hx:commandExButton>

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.