[Zope] Disabling buttons

Ethan Fremen mindlace@majordomo.net
Mon, 18 Oct 1999 21:27:45 +0100


Paul Prescod wrote:
> 
> I'm taking over an app that uses a bunch of client side Java. The only
> reason I can see it uses Java is because it allows you to build logic
> like "if this radio button is selected, this checkbox is disabled." If
> there was a way to do this in a combination of DTML and Javascript then
> the app could use just those technologies. Has anyone got a demo of
> something like that? I can think of fairly convoluted ways to do it --
> is there a straightforward way?

This is actually quite straightforward in the HTML 4.0 spec.  Section 17
discusses forms.

17.12.1 Disabled controls:

The following elements support the disabled attribute: BUTTON INPUT,
OPTGROUP, OPTION, SELECT, and TEXTAREA.

eg: <INPUT disabled name="fred" value="stone">

Note: the only way to dynamically modify the value of the disabled
attribute is through a script.
...
I don't know the exact javascript to do this, but it should be pretty
straightforward.

I imagine you can do this server-side with dtml, but with javascript it
would be all client-side.

-- 
     mindlace
                  Disclaimer: Any use of this email, in any manner
whatsoever, will increase the amount of disorder in the universe. 
Although no liability is implied herein, the reader is warned that 
this process will ultimately lead to the heat death of the universe.