[sclug] XHTML Question
Roland Turner
raz.fpyht.bet.hx at raz.cx
Sat Oct 25 09:05:45 UTC 2003
On Sun, Jun 22, 2003 at 09:32:21AM +0100, Tim Sutton wrote:
> The page I am writing is dynmically rendered using php and, may have an empty
> select box to start with. After user interaction, the page may become valid
> xhtml if the user adds an entry to the select box - however the age still
> wont valid 100% of the time with the w3c validator which is kinda what I was
> aiming for.
You still haven't mentioned what it is you're trying to do (What
is the application? Who are the intended users?, answers to both
of these do affect engineering choices), but you've cleared up an
important point; you're not populating the select box until after
some user interaction has taken place (vs. gratuitously populating
via client-side Javascript at page-load something that could have
been done on the server before the page was delivered). This
leads me to assume then that you are after what amounts to a
disabled selection box, i.e. a placeholder for "there will be
something for you to choose from here if something else happens".
There are at least two elegant ways to implement this in a UI:
- Provide a disabled select box with some default value (perhaps
a blank) showing.
- Blank that part of the screen until there is something for the
user to interact with.
The former is probably simpler, and can be implemented as:
<select disabled="disabled">
<option/>
</select>
(This validates with xhtml1-strict.dtd.)
This makes your Javascript a tiny bit more fiddly if you are
populating your select box incrementally (adding elements as they
come and go, rather than regenerating the select box each time
there is a change), but will still achieve the result that you
are describing.
The latter approach (don't show a select box unles there are
things to select) may result in a better UI.
> WRT using javascript, I appreciate there are a number of problems of it being
> implemented differently in different browsers. However it is useful for
> client side stuff. The only alternatives I see are a) using proprietry or non
> standard tools like flash - which I have never bothered to learn as it does
This narrows your user population still further. All of the
problems that apply to Javascript apply still worse to Flash, but
are compounded by the need to install a plugin, assuming that
such a thing is even permissable.
> not work by default n konq! or b) posting the page back to the server for
> every small user interaction that takes place which will probably waste a lot
> of bandwidth and piss the users off :-(
Sure, but having the thing not work at all will piss off those
users who can't/won't run your Javascript (or worse, those for
whom it malfunctions); you raise an excellent example of graceful
degradation though; make certain that your application works in
multiple-server-roundtrip mode for those who need it, but provide
a client-side Javascript implementation to improve the
interaction with those users who can take advantage of it.
> Is / are there any other alternative to js in the works to provide a better
> option?
The issues will be the same: version skew, security,
administrative controls/firewalls, accessibility, translation
engines, ...
> I could (and probably will) add a dummy entry to the select control and make
> it disappear when a valid entry is added to the control - but it is a lot of
> extra work simply for standards compliance which makes me look for an easier
> way out first :-(
Unless you're doing something rather unusual, it should be
near-trivial; what problem does it create for you? (e.g. show us
the code).
- Raz
More information about the Sclug
mailing list