I think most here know the difference between readonly
and disabled
.
Select Readonly
readonly
does not apply correctly to select
<select name="field" readonly="readonly">
<option value=""></option>
<option value="1">Cliente</option>
<option value="2">Contador</option>
<option value="3">Vendedor</option>
</select>
As you can see I can still change the value of select
Select Disabled
What does not happen with disabled
that actually blocks select
<select name="field" disabled="disabled">
<option value=""></option>
<option value="1" selected>Cliente</option>
<option value="2">Contador</option>
<option value="3">Vendedor</option>
</select>
Here I can not edit, but they are also is sent by the form.
Objective
I need to send the content of the select by the form, but the user can not edit it, its content is auto selected by other factors.
Doubt
- How to block
select
, but still send its value byform
? - Would it be possible without js?
Addendum
In this way I have what I want, but I would like a more elegant method, here he can still see the options.
<select name="field">
<option value="" disabled="disabled"></option>
<option value="1" disabled="disabled" selected>Cliente</option>
<option value="2" disabled="disabled">Contador</option>
<option value="3" disabled="disabled">Vendedor</option>
</select>