Last post Dec 12, 2005 11:37 AM by Pluginbaby
Dec 08, 2005 05:27 PM|Connect|LINK
Dec 09, 2005 04:49 AM|imagemaker|LINK
Since the TextBox control's AddAttributesToRender(HtmlTextWriter) method is where the type="text" key/value pair is added to the attribute array of the HtmlTextWriter, your control inheriting from TextBox could provide a
complete override of this method (rather than first calling this the base method and adding extra attributes). I would want to first take a look at the standard implementation of the TextBox control's AddAttributesToRender() method using Lutz Roeder's
.NET Reflector to be sure that I did not leave out any necessary attributes.
As an alternative, you could provide your own HtmlTextWriter class that would override the inherited HtmlTextWriter's OnAttributeRender function to look at each attribute as it is rendered and return FALSE for the Type="Text" key/value pair, thus filtering
out the unwanted attribute.
Dec 09, 2005 03:10 PM|AndrewSeven|LINK
Any chance you want to share the reason? It might change the answer.
I usualy use Reflector, but you can also check the mono source trees to see a different but equivalent implementation.
Dec 09, 2005 08:03 PM|Connect|LINK
First, thanks for you help so far everyone, it has given me some ideas.
The reason why I want to remove the [b]type=text[/b] name/value pair is as follows:
One of the WAI guidelines for accessibility requires that "include default, place-holding characters in edit boxes and text areas". In other words, for a password field it must actually have the word "Password" pre-populated within it (I don't make these
rules, but our company is bound to them). However, the major problem is that if you can see the word "Password" then it's not a true password field as input is not "starred out".
Then I'm rendering my control using:
Long story, I know :)
Dec 09, 2005 08:18 PM|AndrewSeven|LINK
I think I would take a different route.
Write and think at the same time :P ... I'm not sure either of our approaches would play nice with a screen reader or other browsers that rely on accesibility information.
(Is there a name/label for these kind of browser clients?)
If you set the value attribute ( myPasswordInput.Attributes["value"] = "password" ) then the password will actualy be present in clear text in the source. This value might be used by a special browser.
This is a usefull toolbar that was built by people who are serious about accesibility
Dec 12, 2005 11:37 AM|Pluginbaby|LINK
If you make a custom class for your designer you can use something like this (my exemple remove 2 properties from an IconButtonDesigner control) but I don't know if this will work for the
type="text" attribute :
protected override void PostFilterProperties( _IDictionary Properties )
Properties.Remove( "BackgroundImage" );
Properties.Remove( "BackColor" );