BTW, an important question that we should consider is whether JSF itself should provide a facility for detecting whether client-side scripting is enabled. This could be very useful - ie. could allow us to solve long-standing problems. For example, if we have a way to detect when JavaScript is disabled, seems like we could provide an <h:commandLink> that works when JavaScript is disabled fairly easily (fall back to an <input type="submit">).
I like this idea. Currently this is a wheel that every application (that cares about it) has to reinvent. +1 for providing real-world solutions in Java EE.
As for how to go about detecting whether JavaScript is disabled, I was thinking we would do something along these lines:
- FormRenderer spits out a <script> that dynamically adds a hidden field with some well known name.
- On postback, we check to see whether this hidden field is present
- If the hidden field is present, we know that scripting is enabled. Yay.
- If the hidden field is not present, we assume that scripting is disabled.
Of course, this means that we cannot detect whether JavaScript is enabled until the first postback is performed. Is there some way to get around this? Martin or Jeremy - I know you guys have provided solutions for this sort of thing - please let jump in if you have any suggestions.
What we are most interested in is hearing about feedback from the community. We don't want a solution that people think is naive. If we do it, let's provide a solution that most people are willing to accept. Seems obviously, but obvious hasn't worked in the past.
-Dan