英文:
Orbeon Forms: Change Style in and Action
问题
抱歉,再次为这个简单的问题道歉。
如何在操作中更改文本框或解释文本框的背景颜色?
非常感谢提前帮助。
PeteA
英文:
Sorry again for the simple question..
How can I change the background colour of a text box or an explanatory text box in a action?
Many thanks in advance.
PeteA
答案1
得分: 2
已解决:我在自定义CSS类字段中使用了以下语法:
{if (//PoWRA_Q1 = 'yes') then 'green' else 'red'}
非常感谢Alex指引我找对了方向。
PeteA
英文:
Solved: I used the following syntax in the Custom CSS Classes field:
{if (//PoWRA_Q1 = 'yes') then 'green' else 'red'}
Many thanks Alex for pointing me in the right direction
PeteA
答案2
得分: 1
-
在你自己的CSS中,编写一条规则,以便如果你的文本框或解释性文本具有你选择的CSS类(例如
highlight
),那么它将获得所需的背景颜色。 -
在该文本框或解释性文本的控件设置中,在自定义CSS类下使用XPath值模板,以便仅在满足某种条件时生成
highlight
类,例如{'highlight'[//total > 100]}
,如果字段total
的值超过100,将添加highlight
类。 -
如果无法直接根据表单中的其他值确定是否应添加该类,并且确实需要执行一个操作,那么该操作应设置隐藏字段的值,你将在第二步中在XPath值模板中使用。
英文:
- In your own CSS (doc), write a rule so that if your text box or explanatory text where to have a given CSS class of your choice on it, say
highlight
, then it would get the required background color. - In the control settings for that text box or explanatory text, under custom CSS classes, use an XPath value template to produce the
highlight
class only when a certain condition is met, say{'highlight'[//total > 100]}
, which would add the classhighlight
if the value of the fieldtotal
is above 100. - If you can't directly determine whether the class should be added or not based on other values in the form, and you really needs to run an action, then have that action set the value of hidden field that you use in your XPath value template in step two.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论