RSS Forums RSS
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 1963 | Replies: 4 | Solved | Thread Tools  Display Modes
Reply
Join Date: Jan 2008
Posts: 3
Reputation: thiagarajannn is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
thiagarajannn thiagarajannn is offline Offline
Newbie Poster

Help 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>
Last edited by thiagarajannn : Jan 5th, 2008 at 5:28 am.
Thiagu
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jan 2007
Posts: 2,712
Reputation: MidiMagic is on a distinguished road 
Rep Power: 7
Solved Threads: 124
MidiMagic's Avatar
MidiMagic MidiMagic is offline Offline
Posting Maven

Re: To Pass a selected Value from the combo box onclicking a submit button to the script

  #2  
Jan 7th, 2008
Is that supposed to be html or xml?
Daylight-saving time uses more gasoline
Reply With Quote  
Join Date: Jan 2008
Posts: 3
Reputation: thiagarajannn is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
thiagarajannn thiagarajannn is offline Offline
Newbie Poster

Re: To Pass a selected Value from the combo box onclicking a submit button to the script

  #3  
Jan 7th, 2008
this code is a part of JSF page... and includes HTML tag
Thiagu
Reply With Quote  
Join Date: Jan 2007
Posts: 2,712
Reputation: MidiMagic is on a distinguished road 
Rep Power: 7
Solved Threads: 124
MidiMagic's Avatar
MidiMagic MidiMagic is offline Offline
Posting Maven

Re: To Pass a selected Value from the combo box onclicking a submit button to the script

  #4  
Jan 8th, 2008
- You have "Value" at one point, and "value" at another point. JS is case-sensitive.
Daylight-saving time uses more gasoline
Reply With Quote  
Join Date: Jan 2008
Posts: 3
Reputation: thiagarajannn is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
thiagarajannn thiagarajannn is offline Offline
Newbie Poster

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>
Thiagu
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.



Other Threads in the JavaScript / DHTML / AJAX Forum
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 9:46 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC