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 onclick #893

Closed
chongma opened this issue Nov 30, 2017 · 5 comments
Closed

commandButton onclick #893

chongma opened this issue Nov 30, 2017 · 5 comments
Assignees
Milestone

Comments

@chongma
Copy link
Collaborator

chongma commented Nov 30, 2017

b:commandButton onclick method needs to be protected from returning true. e.g.

<b:commandButton value="Test" action="#{inputTextBean.update}"
	onclick="return confirm('Are you sure?')">
	<f:ajax render="@form" />
</b:commandButton>

results in a page reload.

<b:commandButton value="Test" action="#{inputTextBean.update}"
	onclick="if (! confirm('Are you sure?')) return false">
	<f:ajax render="@form" />
</b:commandButton>

solves the problem.

please see https://stackoverflow.com/questions/4148689/jsf-how-do-i-implement-a-javascript-are-you-sure-prompt-for-a-hcommandbut/4148853?noredirect=1#comment82101529_4148853 for discussion.

also i have written a reproducer on https://github.com/chongma/test called commandButtonOnClick

@stephanrauh
Copy link
Collaborator

What's happening here is that the return false suppresses the AJAX call (which is the desired effect) and replaces it with a simple form submit (which isn't desired at all).

stephanrauh added a commit that referenced this issue Dec 26, 2017
@stephanrauh
Copy link
Collaborator

@chongma I've solved the bug now. Can you double-check it, please?

@stephanrauh stephanrauh added this to the v1.2.0 milestone Dec 26, 2017
@chongma
Copy link
Collaborator Author

chongma commented Jan 5, 2018

has this been released now? i will test it with 1.2.0. also what is the version of the new snapshot for latest version? 2.0-SNAPSHOT?

@stephanrauh
Copy link
Collaborator

Yes, we've released this feature as part of BootsFaces 1.2.0.

The most current snapshot is going to be 1.2.1. Currently, there's none, because we haven't done anything in the 1.2 branch since the release. As for the 2.0 version, I guess we'll move to a public repository when we've managed to implement 20 components. Currently, we're still busy laying the foundations, developing an efficient development process and so on.

@chongma
Copy link
Collaborator Author

chongma commented Jan 21, 2018

forgot to report back. yes it does seem to work now. thank you for fixing it Stephan.

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

No branches or pull requests

3 participants