简体   繁体   中英

CSS: Append Text into inputtext's value

Hi I have a minor problem.

The user want to append some silly text into a inputtext if certain condition is met.

Example

Normal Condition : the inputtext value="#{model.user}"

Abnormal condition: the inputtext should show only "#{model.user} SILLY IDIOT" During abnormal condition the inputtext is ready only

Currently I render 2 different input text for different display, I am wondering if I could use CSS to append the "SILLY IDIOT" in the value.

I have tried value ="#{model.user} SILLY IDIOT" that will promote an error when JSF set the backing bean with the value. I need to set ReadOnly=true, hence the 2 inputtext.

I don't wish to change the code as it will increase complexity, so I prefer a simple css solution.

这不是CSS解决方案,但是您可以使用问号运算符:

value="#{model.user} #{model.user.silly ? 'SILLY IDIOT' : ''}"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM