*
The moose likes JSF and the fly likes Data confusion in dialog after validation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Data confusion in dialog after validation" Watch "Data confusion in dialog after validation" New topic
Author

Data confusion in dialog after validation

Qian Zhao
Greenhorn

Joined: Feb 13, 2012
Posts: 4
Primefaces:3.3.1 or 3.2....
JSF:
<!-- jsf -->com.sun.faces 2.1.2


this is my index page.this page have the datatable. In this ,I deleted some code filed.Basically be to see p:commandButton.
add p:commandButton and edit commandButton show the same dialog.
you can see this image,and this code.chinese you can ignore.





===============================================
you can see this above code:<p:ajax event="close" oncomplete="myrefresh();"></p:ajax>.
myrefresh(); is jscode,it's :
function myrefresh()
{
if(document.getElementsByClassName("ui-messages-error-summary").length!=0){
alert("havae error CSS!");
window.location.reload();
}
}

if dialog have uesd "ui-messages-error-summary" css,index.xhtml will reload.
Now,we don't used this JScode <p:Ajax>.and you see this images.
1.First.
I click index.xhtml's addButton.
show I need dialog.Effect as shown in figure:


And I click this dialog's add button,this button is p:commandButton.
Because some textbox have ==> required="true" requiredMessage="account:not null!".
So..Validation and page show error ..Effect as shown in figure:



OK..now,we click this dialog cancel button.
And ,we return index.xhtml.and click index's editButton.


you can see this,page data is error.


The correct data should be like this


lase: If you click first "editButton", validation and page show error,To continue to open the dialog.Whether to add or edit,the data will error.





Bean code :




I hava no ideal.so i write some javaScript code for this problem,

function myrefresh()
{
/* alert("1:"+document.getElementsByClassName("ui-messages-error-summary")); */
if(document.getElementsByClassName("ui-messages-error-summary").length!=0){
alert("havae error CSS!");
window.location.reload();
}
}

But,I think is bad.........


thanks for you help.
Qian Zhao
Greenhorn

Joined: Feb 13, 2012
Posts: 4
this problem resolve. url:http://forum.primefaces.org/viewtopic.php?f=3&t=23682
Qian Zhao
Greenhorn

Joined: Feb 13, 2012
Posts: 4
tandraschko
Expert Member
Posts: 1172
Joined: 03 Dec 2010, 21:11
30 Jul 2012, 17:08
Re: <I changed topic>Data confusion in dialog after validati
This isn't a bug and we have a more flexible component in primefaces-extensions: http://fractalsoft.net/primeext-showcase-mojarra/sections/resetInput/masterDetailScenario.jsf

if you try it,maybe
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Data confusion in dialog after validation