Menu

#34 DoubleClick prevention on sumbit buttons bug

open
nobody
None
5
2006-03-10
2006-03-10
No

Bebop submit buttons can generate javascript to
prevent doubleclicks by (I think) changing the value
on first click and then checking if the value at the
time of click is the same as the value originally set.

The HTML that is actually output is

<input type="submit" name="save" value="Save"
onclick="if(this.value == 'null') { this.value
= 'Please Wait'; this.form.submit();.........

ie - when the xml is generated in
com.arsdigita.bebop.form.Submit, the value it
retrieves is null, and hence the if clause never
runs.

For an example, add a new freeform html portlet.
Enter the text, and press save as many times as you
like.You can end up with dozens of duplicate portlets.

Chris......

Discussion

  • chris gilbert

    chris gilbert - 2006-03-20

    Logged In: YES
    user_id=1069385

    I think it would be better if the button was disabled when
    clicked (as this prevents doubleclick and gives useful
    feedback to the user). The problem with this is that when
    the button is disabled, the name and value isn't submitted
    with the form data.

    A possible solution is to include a hidden field with each
    button, with id based on the button name eg if button is
    called save, have a hidden field with id save_substitute.
    When the button is clicked, the name and value of the
    hidden field can be set to that of the button using the
    javascript getElementById to identify it. Then the button
    can be disabled and the form submitted with the desired
    name value pair being sent in the request parameters by
    the hidden field.

    Does this sound like a reasonable solution? Do you think
    all buttons on the page should be disabled when one is
    pressed - otherwise, for lengthy requests the user may
    think they can press cancel to stop the request going
    through, when in reality it is too late.

    Chris.....

     
  • Alan Pevec

    Alan Pevec - 2007-04-25

    Logged In: YES
    user_id=1334257
    Originator: NO

    Javascript based DCP (disabling buttons) is included in 1.0.4

     

Log in to post a comment.

MongoDB Logo MongoDB