how can i add styleclass to form tag in xpages

房东的猫 提交于 2020-01-04 02:50:11

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!