问题
I need to add StyleClass
to a form tag generated in xPages
.
I don't know if can change this control in new theme but I only need for one xPage
in my app, this is the code generated:
<form id="view:_id1" method="post" action="/blabla.nsf/index.xsp"
class="xspForm" enctype="multipart/form-data">
And I need this modify class e.g:
<form id="view:_id1" method="post" action="/blabla.nsf/index.xsp"
class="newclass otherclass" enctype="multipart/form-data">
回答1:
You can add the following to your theme to change the class of the form tag:
<control mode="override">
<name>Form</name>
<property>
<name>styleClass</name>
<value>newclass otherclass</value>
</property>
</control>
Update: use the following to only use this on an XPage called index.xsp:
<control mode="override">
<name>Form</name>
<property>
<name>styleClass</name>
<value>#{javascript:(view.getPageName() == '/index.xsp')?'newClass otherClass':'xspForm'}</value>
</property>
</control>
回答2:
You can add your own xp:form on the XPage:
<?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>
回答3:
If you disable form creation in Xpage >All Properties > createForm > False, you can create your own form with your own styleClasses; and that will replace the default form.
来源:https://stackoverflow.com/questions/13212865/how-can-i-add-styleclass-to-form-tag-in-xpages