users@woodstock.java.net

Re: Submit and disable a button

From: Dan Labrecque <Dan.Labrecque_at_Sun.COM>
Date: Thu, 27 Mar 2008 16:15:03 -0500

Are you trying to disable the button only if someValidation() returns
true? If so, you might be able to write your code like so:

    onClick="this.setProps({disabled: someValidation()});"

Or, have the someValidation() function call setProps() using:

    function someValidation(id) {
        var _disabled = true;

        var domNode = document.getElementById(id);
        domNode.setProps({disabled: _disabled});"

        return _disabled;
    }

Then, use something like onClick="return someValidation(this.id);" for
the button tag.

Dan

jangelrp wrote:
> Hi,
> I have a question How can i disable my button for submitting the entire
> form??
>
> Suppose you have:
> a submit webuijsf:button (for submitting the entire form)
> <webuijsf:button id="boton1" text="Save" style="width: 71px"
> primary="true"
> actionExpression="#{Oficinas.alta_action}"
> onClick="this.setProps({disabled: true});
> return someValidation();"
> />
>
> In this case my button is disabled and my function 'someValidation();'
> return true "but the action is ignored cos the button is disabled"
>
> Any ideas about how I could do that?
>
> Sorry for my english!!!
>
> Thanks
>
>
>