Project

General

Profile

Actions

Support #14567

open

Wt4.12.6 Wt::WLineEdit with bootstrap v5 html input with class="form-control" needs disabled for grayed out appearance

Added by robs j 11 days ago. Updated 5 days ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
05/28/2026
Due date:
% Done:

0%

Estimated time:

Description

https://getbootstrap.com/docs/5.2/forms/form-control/ says that "Add the disabled boolean attribute on an input to give it a grayed out appearance".
I was using the method setReadOnly which adds readonly="readonly" but does add the bootstrap "disabled".
Do I need to change my code?

For testing I added manually disabled and now it was grayed.

Actions #1

Updated by robs j 11 days ago

https://getbootstrap.com/docs/5.2/forms/form-control/ says that "Add the disabled boolean attribute on an input to give it a grayed out appearance".
I was using the method setReadOnly which adds readonly="readonly" but does add the bootstrap "disabled".
Do I need to change my code?

For testing I added manually disabled and now it was grayed.

Hiding the element with method setEnabled(bool) has to be done via class="d-none" or style="display: none;" instead of setting "disabled".

But buttons seems to be handled correctly.
todo

Actions #2

Updated by robs j 11 days ago

input type="text" readonly="readonly" class="form-control" disabled

button type="button" disabled="" class="disabled btn btn-secondary" style="display: none;"

Actions #3

Updated by Romain Mardulyn 7 days ago

Hi robs,

I am not sure to understand what your issue is, but here is what I can tell you.

WLineEdit::setReadOnly(true) will make the WLineEdit uneditable, but will change its color to gray (this was is the case for bootstrap 2 and 3 due to haw it handles uneditable widgets).

WLineEdit::setEnable(false) or WLineEdit::setDisable(true) will disable the widget, rendering it uneditable and preventing it from being focussed. In that case it will be grayed out.

WLineEdit::hide() or WLineEdit::setHidden(true) will hide the WLineEdit by setting its display to none.

Actions #4

Updated by robs j 5 days ago

Thanks for responding to my question.
All you stated is correct. But with bootstrap version 5 the result is not the same anymore for html element input.
Are there selenium tests that will check the generated html like code tests in subdirectory test?

Actions #5

Updated by Romain Mardulyn 5 days ago

I am sorry, I made a mistake in the first statement.

It should have been:

WLineEdit::setReadOnly(true) will make the WLineEdit uneditable, but will NOT change its color to gray (this was is the case for bootstrap 2 and 3 due to haw it handles uneditable widgets).

This is a change from Bootstrap, not Wt. You can see it here: https://getbootstrap.com/docs/5.3/forms/form-control/#readonly

Actions

Also available in: Atom PDF