If I have two inputs in a file I’ve received which are “put together” with aspx
<tr>
<td align="right">
<asp:Label ID="Label1" runat="server" Text="User Name:" CssClass="login_label"></asp:Label></td>
<td style="width: 200px">
<asp:TextBox ID="txtUserName" runat="server" TabIndex="1" Width="200px"></asp:TextBox></td>
<td style="width: 3px" align="left">
<asp:RequiredFieldValidator ID="rfvUserName" runat="server" ErrorMessage="RequiredFieldValidator" ControlToValidate="txtUserName">Required</asp:RequiredFieldValidator></td>
</tr>
<tr>
<td align="right">
<asp:Label ID="Label2" runat="server" Text="Password:" CssClass="login_label"></asp:Label></td>
<td style="width: 200px">
<asp:TextBox ID="txtPassword" runat="server" TabIndex="2" Width="200px" TextMode="Password"></asp:TextBox></td>
<td style="width: 3px">
<asp:RequiredFieldValidator ID="rfvPassword" runat="server" ControlToValidate="txtPassword" ErrorMessage="Required">Required</asp:RequiredFieldValidator></td>
</tr>
How can I add autocapitalize="off" attribute to the inputs? Whenever I try to add something to this code——well, most of the time——it just totally breaks. But I would like it to be usable on mobile devices. Thanks for your help!
in the code behind:
that is how you add an attribute to an html element visible by the server.
javascript: be wary this may not work right in all versions of IE. This should be in the document load event
jQuery: same warning as above.
also this should be in $(docuemnt).ready() function or load event.
see this question for a better reason why you can’t do what you want to here:
Autocapitalize attribute on input element (used for iOS) breaks validation
one last edit:
Apparently from the IOS development docs there is an example where you can add the attribute to your form element.
http://developer.apple.com/library/ios/#documentation/AppleApplications/Reference/SafariWebContent/DesigningForms/DesigningForms.html
So maybe you can add it to the form element, which is not an asp namespace control. the validator may cry but you might not get a compile error.