1 Reply Latest reply on Sep 6, 2010 11:14 AM by Ilya Shaikovsky

    javascript and rich:calendar

    Jimmy Valverde Sanchez Newbie

      I can see the 1st (29/08/2010), 2nd(buscartarea), 4th(fecAsigDesde)   alert but 3rd shows me "seg1: undefined", I'd like have the value of fecAsigDesde, how could I do that? any idea plz?

       

      Thx for advance

       

      search.jspx
      <h:form id="buscartarea">
                  <h:panelGrid id="form_seg_tareas" columns="5">
                      <h:outputLabel value="#{msg.label_tareas_fec_asig_desde}" styleClass="form-label" />
                      <rich:calendar id="fecAsigDesde" value="#{TareasBean.busTarea.fecAsigDesde}" datePattern="dd/MM/yy" inputClass="form-input" />
                      <rich:spacer width="20px" />
                      <h:outputLabel value="#{msg.label_tareas_fec_asig_hasta}" styleClass="form-label" />
                      <rich:calendar id="fecAsigHasta" value="#{TareasBean.busTarea.fecAsigHasta}" datePattern="dd/MM/yy" onchanged="compare(this.form,this,'fecAsigDesde');" inputClass="form-input" />
      
      js.js
      
      function compare(frm, pri, seg){
          alert('pri: ' + pri.value);
          alert('frm: ' + frm.name);
          
          var val2 = document.getElementById(frm.name+":fecAsigDesde").value;
          //var val2 = forms.elements[frm.name+":"+seg].value;
          alert('seg1: ' + val2);
          alert('seg: ' + seg);
          ///var val2 = document.forms[frm.name].elements[frm.name+":"+seg].value;
          ///alert('seg2: ' + val2);
          //var val2 = document.getElementById(frm.name+":fecAsigDesde");
          //alert("Value of xyz:" + val2.getProps().value);
          //alert('seg: ' + val2.getProps().value);
      
      }