Question about validation implementation

UI Components for JSF
Post Reply
lana
Posts: 4
Joined: 07 Jun 2010, 10:48

07 Jun 2010, 11:08

Hello,

I want to implement fields validation in such way: validation at server side and then alerting validation error message.

I impletented it using Request Context and javascript alerting. But customer wants something more beautiful (like p:dialog).

Could you advice some primefaces components for such tasks or explain how to use p:dialog in such situations?

Thanks.

callahan
Posts: 768
Joined: 27 May 2010, 22:52

07 Jun 2010, 12:10

Have a look at the validation in the new login dialog: http://www.primefaces.org:8080/prime-sh ... gLogin.jsf
Perhaps it's what you're after.

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

07 Jun 2010, 12:48

Shaking the dialog is optional, but I think your client will like it. ;)

lana
Posts: 4
Joined: 07 Jun 2010, 10:48

07 Jun 2010, 16:57

Thank you!

But how can I do my checks before showing dialog, not after?

lana
Posts: 4
Joined: 07 Jun 2010, 10:48

07 Jun 2010, 18:00

done, using such way:

Code: Select all

 
                        <p:dialog id="errorDlg" widgetVar="errorDlg" fixedCenter="true" header="Hello">
                                <h:outputText value="Hello world" />
                        </p:dialog>
and in handleRequest function:

Code: Select all

               
                          <script type="text/javascript">
                                function handleComplete(xhr, status, args) {
                                           var erMes = args.errorMess;
                                           if (erMes) {
                                                document.getElementById("errorDlg_c").style.visibility = "visible";
                                            }
                                }
                          </script>

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

07 Jun 2010, 18:18

You can use errorDlg.hide() as well instead of setting visibility.

lana
Posts: 4
Joined: 07 Jun 2010, 10:48

07 Jun 2010, 21:01

Yes, but now I have another problem:

after button click handleRequest executed, but then page didn't refresh.

Why does it occure and how to solve it?

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

09 Jun 2010, 10:44

We can't help until seeing the code.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 34 guests