如何在没有onclick事件的情况下显示Richfaces模态窗口? [英] How do I get a richfaces modal window to display without an onclick event?

查看:112
本文介绍了如何在没有onclick事件的情况下显示Richfaces模态窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试实现一个模态窗口像这样向用户显示错误消息.我有一个带有表单的页面,供用户输入他们的信息,然后单击提交"以将其添加到数据库中.如果数据库返回错误,我希望模式窗口弹出并显示错误消息.

I'm trying to implement a modal window like this to display an error message to the user. I have a page with a form for users to enter their information, then click Submit to add it to a database. If the database returns an error, I want the modal window to pop up with the error message.

唯一的问题是,除非有某种onclick事件,否则我无法弹出模式窗口.我尝试使用以下代码:

The only problem is I can't get the modal window to pop up unless there's some kind of onclick event. I tried using the following code:

<rich:componentControl for="popup" attachTo="submitButton"
                       rendered="#{backingBean.isError}" operation="show"
                       event="onclick"/>

这个想法是,如果有错误,支持bean会呈现它,并且确实存在,但是只有之后,您单击提交并点击数据库,然后返回表单以再次单击提交.

The idea is that the backing bean would render it if there is an error, and it does, but only after you click submit and hit the database and get returned to the form to click Submit again.

理想情况下,如果backingBean.isError返回true,我希望在 page 加载时弹出模式窗口,但我感觉缺少某些东西来实现此目的.有什么想法吗?

Ideally, I want the modal window to pop up when the page loads if backingBean.isError returns true, but I feel like I'm missing something to make that happen. Any ideas?

推荐答案

使用showWhenRendered属性:

<rich:modalPanel left="auto" top="250" id="waitpanel"  
    showWhenRendered="#{backingBean.isError}" minWidth="733" autosized="true">

这篇关于如何在没有onclick事件的情况下显示Richfaces模态窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆