Mok
Mok

Reputation: 39

How to disable autocomplete off in struts

<script>
    $(function(){
        $(":input").attr("autocomplete", "off");
    });
</script>

i tried this but some browser(opera)not supported.please help me to solve this error

Upvotes: 0

Views: 1446

Answers (1)

Paul Vargas
Paul Vargas

Reputation: 42040

Just replace in your JSP the Struts 1.x tag:

<html:text property="usr" styleClass="minimalist" size="10" maxlength="15" />

With the equivalent HTML code:

<input type="text" name="usr" class="minimalist" size="10" maxlength="15"
                          │
                          └───── Form property ────┐
                                                   │
       value="<bean:write name="MyForm" property="usr" />" autocomplete="off" />
                                   │                
              Name of form-bean ───┘                

The value of the attribute name of the HTML input tag must match the property of your ActionForm (e.g. usr) in order to Struts 1.x populate the value in that form. If the value of the attribute value of HTML input tag (the actual text show it in the control) is optional, you can forget the bean:write.

Upvotes: 1

Related Questions