2011-03-14 36 views
0

美好的一天帥哥執行。你有沒有知道我們如何能夠阻止或改變f:ajax的onevent的執行?JSF阻止在f:ajax

我有一個在f:ajax中的commandlink。它應該打開一個彈出窗口,但是,如果某些條件不滿足,彈出窗口不應該打開。我想知道這是否可行。

<h:commandLink immediate="true"> 
<f:ajax render="@form" listener="#{myController.executor}" onevent="openDialog"/> 
</h:commandLink> 

回答

2

使用按鈕的onclick屬性。如果它返回false,那麼該按鈕的默認操作將不會被調用。

<h:commandButton onclick="return validateForm(this)"> 
+0

hello balusc,我需要在調用方法(myController.executor)上執行一些操作,它將決定打開彈出窗口的位置。 – Godcode 2011-03-15 08:25:11

+0

@BalusC我需要從內部輸入元素這樣做: ' ' 這可能嗎? – 2015-10-12 13:57:17