users@woodstock.java.net

Re: Submit and disable a button

From: Dan Labrecque <Dan.Labrecque_at_Sun.COM>
Date: Mon, 31 Mar 2008 09:34:54 -0500

jangelrp wrote:
> Thanks Dan for replay!!!
> I explained my problem incorrectly, the idea is to avoid duplicate submit.
> this is the idea,
>
> function someValidation(id,profile) {
>
> if(!valida(profile)){
> // incorrect validation
> return false;
> }
> var domNode = document.getElementById(id);
> domNode.setProps({disabled: true});"
>
> return true;
> }
> In my page
> <webuijsf:button id="boton1" text="Save" style="width: 71px"
> primary="true"
> actionExpression="#{Oficinas.alta_action}"
> onClick="return
> someValidation(this,profile);"
>
> If my method someValidation() return false i can't submit the form the event
> onClick ignore the event, that's correct, i need enter valid information.
>
> otherwise if returns true i would like submit the form but the the problem
> here is that the button is disabled and ignore the actionExpression.
>
> Any idea to sumit my form with my button disabled???
>

I don't follow why you would disable a button, but still submit the
page? Why not disable the button, server-side, after the page has been
submitted? If you really want to submit the page with a disabled button,
you'll have to call the submit() function of the HTML form.

Dan