4 Replies Latest reply on Apr 21, 2011 2:22 AM by Vikas V

    Rich faces : dataGrid and Radio button java script IllegalArgumentException

    Vikas V Newbie

      Hi,

       

      Am using JSF 2.0 and running on Jboss-as-6.0.  Upon clicking a radio button am calling a java script. Both have been pasted below along with exception am getting after running.

       

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml"
         xmlns:h="http://java.sun.com/jsf/html"
         xmlns:ui="http://java.sun.com/jsf/facelets"
         xmlns:f="http://java.sun.com/jsf/core"
         xmlns:p="http://primefaces.prime.com.tr/ui"
         xmlns:rich="http://richfaces.org/rich">

       

       

      <script type="text/javascript"> 
      function radioButton(radio) { 
      var id = radio.name.substring(radio.name.lastIndexOf(':'));
      var el = radio.form.elements;    
      for (var i = 0; i < el.length; i++) { 
        if (el[i].name.substring(el[i].name.lastIndexOf(':')) == id) {  
         el[i].checked = false;           
         }     
        }       
      radio.checked = true; 
      }
      </script>

       

      <h:head>
      <h:outputScript name="jquery.js" target="head" />

       

      <title><ui:insert name="title">Default Title</ui:insert></title>
      </h:head>

      <h:form>
        
         <rich:panel>
              <f:facet name="header">
                  <h:outputText value="Car Store"></h:outputText>
              </f:facet>
              <h:form>
              <rich:dataGrid value="#{abc.allcars}" var="car" columns="3" width="600px">
                  <rich:panel bodyClass="pbody">
                      <f:facet name="header">
                          <h:outputText value="#{car.name}"></h:outputText>
                      </f:facet>
                      <h:panelGrid columns="2">
                          <h:outputText value="Price:" styleClass="label"></h:outputText>
                     
                        <h:selectOneRadio id="carType" value="#{car.price}" onclick="radioButton(this);" >
                    <f:selectItem itemValue="Red" itemLabel="Color1 - Red" />
                   <f:selectItem itemValue="Green" itemLabel="Color1 - Green" />
                  <f:selectItem itemValue="Blue" itemLabel="Color1 - Blue" />
                   
            </h:selectOneRadio>
                  
                          <h:outputText value="Mileage:" styleClass="label"></h:outputText>
                          <h:outputText value="#{car.mileage}" />
                          <h:outputText value="VIN:" styleClass="label"></h:outputText>
                          <h:outputText value="#{car.vin}" />
                          <h:outputText value="Stock:" styleClass="label"></h:outputText>
                          <h:outputText value="#{car.stock}" />
                      </h:panelGrid>
                  </rich:panel>
              </rich:dataGrid>
              </h:form>
          </rich:panel>
          </h:form>      
      </html>

       

       

      ----------------------     Exception -----------------------------------

       

       

      java.lang.IllegalArgumentException: null source
      at java.util.EventObject.<init>(EventObject.java:38)
      at javax.faces.event.SystemEvent.<init>(SystemEvent.java:67)
      at javax.faces.event.ComponentSystemEvent.<init>(ComponentSystemEvent.java:69)
      at javax.faces.event.PostRestoreStateEvent.<init>(PostRestoreStateEvent.java:69)
      at com.sun.faces.lifecycle.RestoreViewPhase.deliverPostRestoreStateEvent(RestoreViewPhase.java:256)
      at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:245)
      at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:97)
      at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:107)
      at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:114)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:308)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:324)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:181)
      at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.event(CatalinaContext.java:285)
      at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.invoke(CatalinaContext.java:261)
      at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:88)
      at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:100)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve.invoke(ActiveRequestResponseCacheValve.java:53)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:654)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:951)
      at java.lang.Thread.run(Thread.java:619)

       

       

      What could be the possible problem with the above code?