You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by sp...@indiana.edu on 2005/11/06 20:22:22 UTC

using javascript for RadioButton event

Hi ,

I am using javascript as suggested by Bruno for invoking an action when I
choose/click on a radiobutton. My problem is that the javascritp is not called
at all. 
Here's my code. Can anyone find any error in my code.

<script language="javascript">
	
		function showFilesList() {
		
			document.getElementById("whereForm:displayFiles").click();

		}
		
	
	</script>
<body>

<h:selectOneRadio id="showFilesOption" value="0" onclick="showFileList()"
layout="pageDirection" style ="font-family: Arial, sans-serif; color:grey;">
			        				<f:selectItem itemValue="0" itemLabel="Entire collection"/>
			        				<f:selectItem itemValue="1" itemLabel="Files in collection"/>
			        			</h:selectOneRadio>	
	        					<h:selectManyListbox id="filesListbox" style="width: 300"
rendered="false">
	        						<f:selectItems id="filesListItems"
value="#{MyLeadTreePublish.items}"/>
	     			   			</h:selectManyListbox>
<h:commandButton id="displayFiles" value="View Files >>>"
actionListener="#{MyLeadTreePublish.DisplayFiles}" rendered="false"/>		
    
</body>


I dont think the function showFileList() is not called at all I guess. Any ideas.

Thanks

Re: using javascript for RadioButton event

Posted by Bruno Aranda <br...@gmail.com>.
You can hide the button using a style (style="visibility:hidden;"), so
you can use javascript to click it while the button is not shown...

Bruno

2005/11/6, speriyas@indiana.edu <sp...@indiana.edu>:
> yes, I maade rebdered to be "true" and onclick attribute of radiobutton works
> instead of onselect for some reason.
>
> Thanks Bruno and Volker.
>
>
>
>
>
>
> Quoting Volker Weber <us...@weber-oldenburg.de>:
>
> > Hi,
> >
> > you can't invoke click() on a button which is not rendered!
> >
> > you have rendered="false" in your button. The javascript can't find the
> > element. there must be an javascript error in your client.
> >
> > regards
> >   Volker
> >
> > speriyas@indiana.edu wrote:
> > > Hi ,
> > >
> > > I am using javascript as suggested by Bruno for invoking an action when I
> > > choose/click on a radiobutton. My problem is that the javascritp is not
> > called
> > > at all.
> > > Here's my code. Can anyone find any error in my code.
> > >
> > > <script language="javascript">
> > >
> > >             function showFilesList() {
> > >
> > >                     document.getElementById("whereForm:displayFiles").click();
> > >
> > >             }
> > >
> > >
> > >     </script>
> > > <body>
> > >
> > > <h:selectOneRadio id="showFilesOption" value="0" onclick="showFileList()"
> > > layout="pageDirection" style ="font-family: Arial, sans-serif;
> > color:grey;">
> > >                                                             <f:selectItem itemValue="0" itemLabel="Entire collection"/>
> > >                                                             <f:selectItem itemValue="1" itemLabel="Files in
> > collection"/>
> > >                                                     </h:selectOneRadio>
> > >                                                     <h:selectManyListbox id="filesListbox" style="width: 300"
> > > rendered="false">
> > >                                                             <f:selectItems id="filesListItems"
> > > value="#{MyLeadTreePublish.items}"/>
> > >                                                     </h:selectManyListbox>
> > > <h:commandButton id="displayFiles" value="View Files >>>"
> > > actionListener="#{MyLeadTreePublish.DisplayFiles}" rendered="false"/>
> > >
> > > </body>
> > >
> > >
> > > I dont think the function showFileList() is not called at all I guess. Any
> > ideas.
> > >
> > > Thanks
> > >
> >
> > --
> > Don't answer to From: address!
> > Mail to this account are droped if not recieved via mailinglist.
> > To contact me direct create the mail address by
> > concatenating my forename to my senders domain.
> >
>
>
>

Re: using javascript for RadioButton event

Posted by sp...@indiana.edu.
yes, I maade rebdered to be "true" and onclick attribute of radiobutton works
instead of onselect for some reason.

Thanks Bruno and Volker.






Quoting Volker Weber <us...@weber-oldenburg.de>:

> Hi,
> 
> you can't invoke click() on a button which is not rendered!
> 
> you have rendered="false" in your button. The javascript can't find the
> element. there must be an javascript error in your client.
> 
> regards
>   Volker
> 
> speriyas@indiana.edu wrote:
> > Hi ,
> > 
> > I am using javascript as suggested by Bruno for invoking an action when I
> > choose/click on a radiobutton. My problem is that the javascritp is not
> called
> > at all. 
> > Here's my code. Can anyone find any error in my code.
> > 
> > <script language="javascript">
> > 	
> > 		function showFilesList() {
> > 		
> > 			document.getElementById("whereForm:displayFiles").click();
> > 
> > 		}
> > 		
> > 	
> > 	</script>
> > <body>
> > 
> > <h:selectOneRadio id="showFilesOption" value="0" onclick="showFileList()"
> > layout="pageDirection" style ="font-family: Arial, sans-serif;
> color:grey;">
> > 			        				<f:selectItem itemValue="0" itemLabel="Entire collection"/>
> > 			        				<f:selectItem itemValue="1" itemLabel="Files in
> collection"/>
> > 			        			</h:selectOneRadio>	
> > 	        					<h:selectManyListbox id="filesListbox" style="width: 300"
> > rendered="false">
> > 	        						<f:selectItems id="filesListItems"
> > value="#{MyLeadTreePublish.items}"/>
> > 	     			   			</h:selectManyListbox>
> > <h:commandButton id="displayFiles" value="View Files >>>"
> > actionListener="#{MyLeadTreePublish.DisplayFiles}" rendered="false"/>		
> >     
> > </body>
> > 
> > 
> > I dont think the function showFileList() is not called at all I guess. Any
> ideas.
> > 
> > Thanks
> > 
> 
> -- 
> Don't answer to From: address!
> Mail to this account are droped if not recieved via mailinglist.
> To contact me direct create the mail address by
> concatenating my forename to my senders domain.
> 



Re: using javascript for RadioButton event

Posted by Volker Weber <us...@weber-oldenburg.de>.
Hi,

you can't invoke click() on a button which is not rendered!

you have rendered="false" in your button. The javascript can't find the
element. there must be an javascript error in your client.

regards
  Volker

speriyas@indiana.edu wrote:
> Hi ,
> 
> I am using javascript as suggested by Bruno for invoking an action when I
> choose/click on a radiobutton. My problem is that the javascritp is not called
> at all. 
> Here's my code. Can anyone find any error in my code.
> 
> <script language="javascript">
> 	
> 		function showFilesList() {
> 		
> 			document.getElementById("whereForm:displayFiles").click();
> 
> 		}
> 		
> 	
> 	</script>
> <body>
> 
> <h:selectOneRadio id="showFilesOption" value="0" onclick="showFileList()"
> layout="pageDirection" style ="font-family: Arial, sans-serif; color:grey;">
> 			        				<f:selectItem itemValue="0" itemLabel="Entire collection"/>
> 			        				<f:selectItem itemValue="1" itemLabel="Files in collection"/>
> 			        			</h:selectOneRadio>	
> 	        					<h:selectManyListbox id="filesListbox" style="width: 300"
> rendered="false">
> 	        						<f:selectItems id="filesListItems"
> value="#{MyLeadTreePublish.items}"/>
> 	     			   			</h:selectManyListbox>
> <h:commandButton id="displayFiles" value="View Files >>>"
> actionListener="#{MyLeadTreePublish.DisplayFiles}" rendered="false"/>		
>     
> </body>
> 
> 
> I dont think the function showFileList() is not called at all I guess. Any ideas.
> 
> Thanks
> 

-- 
Don't answer to From: address!
Mail to this account are droped if not recieved via mailinglist.
To contact me direct create the mail address by
concatenating my forename to my senders domain.

Re: using javascript for RadioButton event

Posted by Bruno Aranda <br...@gmail.com>.
Is your javascript script inside the <head>? If you are using firefox,
you can check with the javascript console if there are errors with the
javascript... BTW, can you check the output HTML to see if the
onchange attribute is rendered somewhere?

Regards,

Bruno

2005/11/6, speriyas@indiana.edu <sp...@indiana.edu>:
>
> Hi ,
>
> I am using javascript as suggested by Bruno for invoking an action when I
> choose/click on a radiobutton. My problem is that the javascritp is not called
> at all.
> Here's my code. Can anyone find any error in my code.
>
> <script language="javascript">
>
>                 function showFilesList() {
>
>                         document.getElementById("whereForm:displayFiles").click();
>
>                 }
>
>
>         </script>
> <body>
>
> <h:selectOneRadio id="showFilesOption" value="0" onclick="showFileList()"
> layout="pageDirection" style ="font-family: Arial, sans-serif; color:grey;">
>                                                                 <f:selectItem itemValue="0" itemLabel="Entire collection"/>
>                                                                 <f:selectItem itemValue="1" itemLabel="Files in collection"/>
>                                                         </h:selectOneRadio>
>                                                         <h:selectManyListbox id="filesListbox" style="width: 300"
> rendered="false">
>                                                                 <f:selectItems id="filesListItems"
> value="#{MyLeadTreePublish.items}"/>
>                                                         </h:selectManyListbox>
> <h:commandButton id="displayFiles" value="View Files >>>"
> actionListener="#{MyLeadTreePublish.DisplayFiles}" rendered="false"/>
>
> </body>
>
>
> I dont think the function showFileList() is not called at all I guess. Any ideas.
>
> Thanks
>