2013-03-19 89 views
2

我使用了Primefaces日历组件,并且它不在窗体内部工作。当我单击“在文本框上”时,弹出框会尽快消失。 外部h:form弹出窗口显示自己,但整体组件仍然不像月/年不可选择的工作。为什么建议?Primefaces日历组件不在表单中工作

以下是我advSearch.xhtml的facelet其模板为Master.xhtml

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

<ui:composition xmlns="http://www.w3.org/1999/xhtml" 
xmlns:ui="http://java.sun.com/jsf/facelets" 
xmlns:h="http://java.sun.com/jsf/html" 
xmlns:f="http://java.sun.com/jsf/core" 
xmlns:p="http://primefaces.org/ui" 
template="/MasterPage/Master.xhtml"> 

<ui:define name="Search"> 

    <h:form id="advSearch" onmousemove="removeExtra()"> 

      <p:layout style="width:1218px;height:558px;" id="layout"> 



       <p:layoutUnit position="center" styleClass="resultDiv"> 

        <div class="advDiv"> 

         <div class="advHeader">Find documents That Have...</div> 
         <div class="advBody"> 

          <table> 
           <tr> 
            <td><h:outputText styleClass="advLabel" value="Subject"></h:outputText></td> 
            <td><h:inputText 
              value="#{advanceSearchController.subject}" 
              styleClass="txtfield" 
              onkeypress="if (event.keyCode == 13) { document.getElementById('advSearch:advButton').click(); return false; }"></h:inputText> 
            </td> 
           </tr> 


           <tr> 
            <td><h:outputText styleClass="advLabel" value="Signed By"></h:outputText></td> 
            <td><h:inputText 
              value="#{advanceSearchController.signBy}" 
              styleClass="txtfield" 
              onkeypress="if (event.keyCode == 13) { document.getElementById('advSearch:advButton').click(); return false; }"></h:inputText></td> 
           </tr> 
           <tr> 
            <td><h:outputText styleClass="advLabel" 
              value="Archived From"></h:outputText></td> 
            <td><p:calendar styleClass="txtfield" mode="popup" 
              navigator="true" yearRange="1900:2015" pattern="MM/dd/yyyy" 
              converter="CalendarDateStringConverter" 
              value="#{advanceSearchController.fromdate}" /></td> 
           </tr> 
           <tr> 
            <td><h:outputText styleClass="advLabel" value="To"></h:outputText></td> 
            <td><p:calendar styleClass="txtfield" mode="popup" 
              navigator="true" yearRange="1900:2015" pattern="MM/dd/yyyy" 
              converter="CalendarDateStringConverter" 
              value="#{advanceSearchController.todate}" /></td> 
           </tr> 
          </table> 
          <h:commandButton id="advButton" styleClass="btn" 
           value="Advanced Search" 
           action="#{advanceSearchController.advanceSearch}" 
           style="background-color:#FEAA41;background-image:none;color:white;font-weight:bold;"></h:commandButton> 
         </div> 
        </div> 

       </p:layoutUnit> 
      </p:layout> 
     </div> 

    </h:form> 

</ui:define> 

任何帮助将不胜感激。

+1

尝试最低配置(只有内部日历形式)并检查它是否仍然无法正常工作。在这里报告结果。 – 2013-03-19 08:22:38

+0

代码看起来不错,但有一件事,我只是看到一个JS函数,你在窗体上调用onmousemove =“removeExtra()”。正如你所说弹出窗口很快消失意味着它来了,然后消失。它表明日历工作正常很好,但有其他地方是错误的。检查两件事情(1)当您在日历栏中单击后移动光标时,字段是否会消失(意思是单击并查看它是否消失,如果没有,则移动光标,然后检查是否因为您打电话给您(2)删除这个removeExtra()函数,然后检查 – Despicable 2013-03-19 10:00:09

+0

@Matt Handay使用它的h:head和h:body(即不包含在Master.xhtml)。日历工作正常。 – 2013-03-19 10:43:31

回答

0

代码似乎很好,但有一件事,我只是看到一个JS函数,你在窗体上调用onmousemove="removeExtra()"
正如你所说弹出快速消失意味着它来了,然后消失。它表明日历工作正常,但有其他地方是错的。
请检查两件事
(1)当你移动光标点击在砑光机后场(意思是只要按一下,看看它是否消失,如果没有再移动,然后将光标检查,因为你叫你的JS功能无法磁场消失onmouseover事件所以它可能是鼠标移动的问题)
(2)删除此removeExtra()函数,然后检查

+0

谢谢,真的很有帮助 – 2013-03-19 11:10:38