simple question really (can hazard a guess but just need to make sure),
Just need a Yes/No answer as can't seem to claify anywhere.
Reason? Web pages for phones, where javascript support is "sketchy" among all mobile browsers, so doing away with anything javascript altogether and was wondering if there are any alternatives.
(Also before someone tells me off, I am of course implementing server-side validation by default, better if possible to validate stuff right away on the client as phone text entry isn't particulaly fun to go throug开发者_如何学Pythonh multiple times. Also webpage is asp.net 2.0 & c# should that affect anything)
No, there is not.
I mean, obviously, the more involved answer is "Yes, of course, there are other types of client-side scripting systems (Flash/Silverlight/ActiveX/etc) that can do it", but in the context of your question (phones) then the answer is No.
I do suggest, however, that you may be surprised at what phones run JavaScript. Keep it basic, and keep it such that it fails gracefully (i.e. no harm comes to the functionality of the app with JS disabled) and you'll probably be surprised at the compatibility.
HTML itself allows for a very little bit of validation (the maxlength of the input forms, which is not much, as a validation).
Which means you need "more", to do real/useful validation on the client side... , if you want something that works in almost every browser, that's accessible, that doesn't annoy the user, ...
As a sidenote : don't ever forget server-side validation !
(Yes, you said it in your question -- but it's never said too many times ^^ )
Yes — but only in an even more limited range of browsers than those which support (and have enabled) JS.
e.g. You could use client side VBScript.
No , there is nothing except for javascript for client side for client side validation for the time being.
But it seems that HTML5 has some interesting tags thet will help. http://dev.w3.org/html5/spec/forms.html
It is possible to validate HTML forms without JavaScript now. Have a look at How to validate HTML5 forms without JavaScript
Not really. HTML itself only allows to limit the maximum length of a text box, which is some sort of "validation" (by restriction).
But then again - very many mobile browsers DO run JavaScript, even "Opera Mini" does support basic (or not that basic?) things of JS. Mobile Opera has full JS support, IE - too.
There is a nice list of who-can-do-it on QuirksMode.org (here: http://www.quirksmode.org/m/table.html)
One thing I'd suggest looking at is the Mobile Device Browser File - you state that you're using ASP.NET 2.0, so provided that your server's up to date (i.e. it has .NET Framework 2.0 SP2 installed), you should be able to use it.
This will help your site determine which browser is viewing your site, what it supports in terms of controls, etc, and help you respond appropriately to the requests.
I.e. if you know in advance that the browser doesn't support JavaScript, you can remove the client side validation altogether and not send all the extra markup to the browser, making their experience of the site even cleaner.
Basically, no.
If your market includes browsers that support the new HTML5 input types, there's some very basic things you can do there: http://diveintohtml5.ep.io/forms.html
Beyond that though, Javascript is really the only real client-side option.
(It could also be done in VBScript, but only in Internet Explorer)
精彩评论