Forum Moderators: open

Message Too Old, No Replies

ASP.NET and Accessibility

Postback Javascripts Abound!

         

Krapulator

7:23 am on May 25, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have recently started my first foray into asp.net and I am extremely disappointed at the lack of accessibility built into the generated code.

All of new paging and sorting functions all rely on client-side javascript to function. It seems impossible to use any asp.net applications to any extent with javascript turned off. All of the postback functions are triggered by javascript only.

Am I missing something here? The new datagrid features are amazingly cool and useful - but I cannot in all good faith put any of it to use unless it works in non-js scenarios.

With all the recent talk about accessibility (not to mention the legal issues) it is very surprising that MS have taken a step in this direction with dot net.

tafkar

8:38 am on May 25, 2004 (gmt 0)

10+ Year Member



Hi Krapulator!

Your post just reflects what I thought when diving into ASP.NET. At first I thought: "Wow, can it really be that easy to create database-driven sites and applications with all these new gadgets?"

Then I looked into the output HTML and was merely stunned. I mean I didn't expect them to produce W3C-compliant HTML, but what I saw seemed so much tailored for the latest IE and nothing else.

I came around using the ClientTarget=Downlevel switch to get around the overuse of JS. It helped a bit, but to me it seemed it only made the post-back much more of a hassle.

I like the concept of what's behind the whole ASP.NET idea, but as long as it is so dependant on the IE I refrain from using it and am back to hand-coded ASP.

korkus2000

5:29 pm on May 25, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



.Net is in its infancy. Yes it is depended on JS now, but the newer versions are promising. If you are just creating a datadriven site then I don't think .Net is mature enough for this task. It has been developed to be robust for enterprise level applications on the web. Usually these high functionality apps need js and require a modern browser. You also really don't want these spidered.

If you are just looking to do some basic database stuff for basic browsing then .Net maybe not for you.

>>but as long as it is so dependant on the IE

Personally I really have not had a cross browser problem. Mozilla, Netscape, and Opera seem to work fine with the code. Also using the built in asp.net form elements is not always the best way to code.

tafkar

5:53 am on May 26, 2004 (gmt 0)

10+ Year Member



>>but as long as it is so dependant on the IE

Personally I really have not had a cross browser problem. Mozilla, Netscape, and Opera seem to work fine with the code. Also using the built in asp.net form elements is not always the best way to code.

You hit the nail on the head. With the form elements I had the worst trouble in cross browser accessibility. Those validation controls for forms made me think that I could save a lot of work when coding forms (yes, I have to code a real lot of forms ;-) But they didn't work as expected in other browsers than IE no matter what I tried to get around with.

.Net is in its infancy. Yes it is depended on JS now, but the newer versions are promising.

Looking forward to it. Do you have any pointers where to read about those newer versions?

cheers

tafkar

Jimmy Turnip

8:53 am on May 26, 2004 (gmt 0)

10+ Year Member



I too have had formatting problems with the form elements, but never functionality issues.

I thought the whole point of using the form elements was that .net generates the output html based on the browser that has requested it?

Jimmy Turnip

10:08 am on May 26, 2004 (gmt 0)

10+ Year Member



Actually, i've just noticed that when .net renders a asp:textbox control in firefox it completely ignores the width property, if it is a percentage or pixel value. Surely that's not right.

Krapulator

11:16 pm on May 26, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



>>I thought the whole point of using the form elements was that .net generates the output html based on the browser that has requested it?

I haven't seen any evidence of this so far. I tried using my new application with IE (with js turned off) - nothing! I tries my trusty text-based browser - nothing! I haven't tried it with a web-enabled mobile (cellphone) but I bet it doesn't work in there either.

Does anyone know of anyway .net postbacks can be made to work without javascript?

Xoc

12:23 am on May 27, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Much of the client side JavaScript can be turned off. For example, all of the Validator controls have a property called EnableClientScript. The default is set to true. If you set it to false, then all of the validation is done server side

If you do this, the amount of client side JavaScript is minimal, and should work cross browser.

Any control that has an AutoPostback property set to true requires JavaScript to work. There is no way around this, as a hyperlink, listbox, or checkbox, etc., cannot ordinarily cause a form to post. However, that doesn't mean that you can't create ASP.NET applications that don't have JavaScript. You just must be careful what controls and properties you use. For example, if you use a listbox with the AutoPostback property set to false, and put a submit button next to it, then no JavaScript is sent down to the client.

This is a limitation of HTML, not of ASP.NET. There are only two ways to submit a form: a submit button, or JavaScript. So there must be one or the other to get it to work. You won't be able to do it in Cold Fusion or PHP either, since they are restricted to what the browser supports. Even if HTML were enhanced to allow some additional ways to post a form, that would just mean that your code wouldn't work on old browsers--not a desirable effect.

sqlgod

6:29 pm on May 27, 2004 (gmt 0)

10+ Year Member



AS was stated earlier try using a submit button instead of the autopostback with dropdowns and the like. If its a link of some sort that you need to postback try adding to the querystring with the required info.

For instance if it was a remove item button in a shopping cart, instead of having it postback so you could get the datakey and remove the item you could just make the link "<current page>.aspx?rmv=<id of product to remove>

then you could just read the querystring and remove the item.

Krapulator

11:05 pm on May 27, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It was actually the built in paging and sorting functions that I was interested in. I am complete .net newbie but as soon as I discovered that these funtions were built in - I was completely stoked at how much coding time and effort this would save.

You're right Xoc I did jump at the gun a bit, obviously the only other way to submit a form would be with submit buttons (which would be quite ugly). It would have been good if perhaps they had built this functions with the option to use normal hyperlinks with some kind of id appended to the querystring - something like <a href="?postback=true&id=whatever>.

Thanks all for the comments.

duckhunter

2:20 am on May 28, 2004 (gmt 0)

10+ Year Member



Well said Xoc.