Tag Archives: value

Solve the problem that the value in the disabled tag cannot be passed to the server

disable tag values do not pass values to the server

<input type="text" name="did" value="${dept.did}" disabled="disabled"/><br/>

solution

  1. replace the field disabled in the form with readonly (if necessary, add a gray background color to the form)

    <input type="text" name="did" value="${dept.did}" readonly/><br/>
    

  2. you can write a hidden attributes, one for the value of a is used to display

    for example: add a hidden TAB and the name and value are set to the same value as the disable tag to successfully pass the value

    <input type="hidden" name="did" value="${dept.did}" >
    <input type="text" value="${dept.did}" disabled="disabled"/><br/>
    

    disabled

    similarity

    • can make text boxes cannot be entered.
    • can be modified by js script.
    • want to cancel, can only delete the corresponding attribute, set flase invalid

    different points

    disabled

    • input cannot receive focus
    • using the TAB key will skip the element
    • disabled will not respond to any event (e.g. the click event is invalid). The value of the disabled element
    • is not committed. The
    • disabled property can be used on all form elements.

    readonly

    • input can receive focus
    • use the TAB key does not skip elements
    • readonly will respond to events.
    • readonly element values are submitted. The
    • readonly property is only valid for type= “text”, textarea, and type= “password”.

    disabled will not be submitted to the server can’t be serialized but can be js can’t be modified on the interface all controls have disabled property

    readonly will be submitted to the server can be serialized can be js value assignment interface can’t modify all controls not necessarily have readonly property such as select drop down box