Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CommandButton: actions are called twice #259

Closed
stephanrauh opened this issue Jan 17, 2016 · 6 comments
Closed

CommandButton: actions are called twice #259

stephanrauh opened this issue Jan 17, 2016 · 6 comments
Assignees
Labels
Milestone

Comments

@stephanrauh
Copy link
Collaborator

I noticed this in the tab demo. The action is called twice. Someone else reported a similiar issue concerning datatable. Might be a general problem.

@stephanrauh stephanrauh self-assigned this Jan 17, 2016
@stephanrauh stephanrauh added this to the v0.8.2 milestone Jan 17, 2016
@XaeroDegreaz
Copy link
Contributor

I'm also seeing this problem.

However, when I have a commandButton using a standard value for a label like:

<b:commandButton
    value="UP"
    action="#{questionPage.changeOrder('up', question, assessmentGroup)}"
    ajax="true"
    update="@form"
    rendered="#{question.questionOrder ne 1}" />

It does not double trigger.

If I use one with a glyphicon:

<b:commandButton
    icon="arrow-up"
    action="#{questionPage.changeOrder('up', question, assessmentGroup)}"
    ajax="true"
    update="@form"
    rendered="#{question.questionOrder ne 1}" />

I can reliably get it to double-trigger when clicking on the icon directly but if I click on the button outside the icon, then it does not double-trigger.

@stephanrauh
Copy link
Collaborator Author

Interesting. I looked for the error at a different part of the source code. The tab demo is a non-AJAX commandButton without icon. I'll keep it in mind, anyways - you might be up to something.

@stephanrauh
Copy link
Collaborator Author

Non-AJAX commandButtons generate HTML code that calls BsF.ajax.cb(this, event); without adding return false;. That amount to calling an AJAX request, followed suite by a traditional non-AJAX request. Removing the AJAX call solves the problem. Thing is, I'm sure the code in AJAXRenderer, lines 183-214, serves a purpose, so simply removing it is no good.

stephanrauh added a commit that referenced this issue Jan 23, 2016
@stephanrauh
Copy link
Collaborator Author

I've fixed the bug and uploaded a developer snapshot to Maven Central.

@XaeroDegreaz The bug I've found has nothing to do with the glyphicon. Would you mind to test your code again to verify the bug has been solved? If not, please reopen the issue. See #151 on how to get the developer snapshot.

@saptarshibasu
Copy link

Yes. The bug is fixed. I was facing the same issue since last week. Just now I have tested with the new jar and have found it working. The issue was happenning with Chrome only.

@stephanrauh
Copy link
Collaborator Author

Great! Thanks for giving us feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants