• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Primefaces: Two mesages getting displayed instead of one for ajax blur event

 
Ranch Hand
Posts: 40
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have one row editable datatable.I have implemented email validation to one of the column where error message must display on blur of email field.This is working fine.I have a dialog with form to be displayed in the same page .Validation is implemented to this form also with on blur event.The dialog validation message gets displayed on blur but along with that the main form also displays the same validation message.This should not happen.

Any idea on how to fix this problem?

JSF page



The message with id lpcErrMsg is the one that i am displaying on blur in the main page when email format is wrong.And this message gets displayed with dialog field validation also although i have never referred to this id to be rendered in the dialog.

The message with id lpcDlgMsg is the message that i am displaying inside the dialog with widgetvar dlg on blur.As of now i have implemented blur event validation for the first required field in the dialog.
 
Saloon Keeper
Posts: 28654
211
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I propably didn't read that correctly. The longer the sample, the lazier I get, which is why it's a good idea to strip down examples to their basics.

However, what I think is going on is this:

Firstly, an AJAX element does a form submit, subject to the usual JSF rules. Meaning that for whatever fields the form contains, ALL submitted fields MUST be valid or nothing works. With AJAX the effective number of fields in the submitted form can be adjusted (for example, to only submit the email field itself), but I can't remember what the defaults are on that tag, so I recommend that you check the official docs to make sure you're doing it the way you need to.

In the case of a commandButton, the ENTIRE form is submitted and instead of partial page rendering, you get a full-page render of the response. And, as before, ALL fields on the form must be valid or the submit is rejected.

I don't use AJAX for Cancel buttons normally. The stock h:commandButton with "immediate=true" works pretty much the same way. You should verify that "onclick" isn't supposed to return a value. I know that the "submit=" attribute must return true or false because returning false suppresses the actual submit part of the button operation.
reply
    Bookmark Topic Watch Topic
  • New Topic