Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
![]() |
•
•
Join Date: Jan 2008
Posts: 3
Reputation:
Rep Power: 0
Solved Threads: 0
To Pass a selected Value from the combo box onclicking a submit button to the script
#1
Jan 5th, 2008
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>
<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>
Last edited by thiagarajannn : Jan 5th, 2008 at 5:28 am.
Thiagu
Re: To Pass a selected Value from the combo box onclicking a submit button to the script
#2
Jan 7th, 2008
•
•
Join Date: Jan 2008
Posts: 3
Reputation:
Rep Power: 0
Solved Threads: 0
Re: To Pass a selected Value from the combo box onclicking a submit button to the script
#3
Jan 7th, 2008
Re: To Pass a selected Value from the combo box onclicking a submit button to the script
#4
Jan 8th, 2008
•
•
Join Date: Jan 2008
Posts: 3
Reputation:
Rep Power: 0
Solved Threads: 0
Re: To Pass a selected Value from the combo box onclicking a submit button to the script
#5
Jan 9th, 2008
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>
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>
Thiagu
![]() |
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Stopping PHP
- Next Thread: sample Programs using Ajax controls links or programing code
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)






Linear Mode