2012-11-03 33 views
3

我需要將StyleClass添加到xPages中生成的表單標籤。如何添加styleclass以形成xpages標籤

我不知道是否可以更改新的主題,這種控制,但我只需要在我的應用程序一個xPage,這是生成的代碼:

<form id="view:_id1" method="post" action="/blabla.nsf/index.xsp" 
class="xspForm" enctype="multipart/form-data"> 

我需要這個修改類如:

<form id="view:_id1" method="post" action="/blabla.nsf/index.xsp" 
class="newclass otherclass" enctype="multipart/form-data"> 

回答

7

您可以添加以下到你的主題改變類的窗體標籤:

<control mode="override"> 
    <name>Form</name> 
    <property> 
     <name>styleClass</name> 
     <value>newclass otherclass</value> 
    </property> 
</control> 

更新:使用下面的方法只能用這個名爲index.xsp一個XPage:

<control mode="override"> 
    <name>Form</name> 
    <property> 
     <name>styleClass</name> 
     <value>#{javascript:(view.getPageName() == '/index.xsp')?'newClass otherClass':'xspForm'}</value> 
    </property> 
</control> 
+0

但是這改變了我的應用程序的所有xpages中的所有表單? –

+1

是的,它的確如此。您可以嘗試使用#{javascript:(view.getPageName()=='/index.xsp')?'newClass otherClass':'xspForm'}

+0

奇妙的計算值部分。感謝您的回覆 –

5

您可以添加自己的XP:

<?xml version="1.0" encoding="UTF-8"?> 
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" createForm="false"> 
    <xp:form styleClass="newclass otherclass"> 
     ... add your components here ... 
    </xp:form> 
</xp:view> 
+0

而且我需要所有其他屬性?方法,身份證,行動等?謝謝 –

+0

「添加」對不起,我的iPhone鍵盤更改爲「全部」 –

+0

不,這些屬性是由XPages引擎自動生成的。在這裏你可以找到所有可用的屬性:http://www.openntf.org/xspext/xpages%20extension%20library%20documentation.nsf/xpages-doc/xp_form.html –

0

如果禁用:對的XPage形式在Xpage> All Properties> createForm> False中創建表單,您可以使用自己的styleClasses創建自己的表單;並且將取代默認形式。

enter image description here

相關問題