• 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:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

PrimeFaces p:calendar not calling setter method

 
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a PrimeFaces page with a calendar component on it. Radio buttons on that page work fine and call the setter method on the back end. The Calendar however doesn't call the setter. The getter method is called on page display.

I'm using the PrimeFaces v 5.0 jar file.

Does anyone see what I might be doing wrong?

Thanks, code follows:



 
Saloon Keeper
Posts: 28770
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
You say "radio buttons work fine, but I only see one radio button. And its onchange= attribute, which should be resolvable as a javascript expression appears to resolve to label text, instead. ???

There's no submit control in your code sample and no AJAX, so unless there's something somewhere else I don't see how the backing bean would be updated for either radio button or calendars.
 
Ray Clark
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I didn't post the full xhtml page. There are actually 12 radio buttons on the page and the submit button is in a different xhtml page.

I'm new to PrimeFaces and JSF so I'm sure it is something simple. I did searches on the web and have tried various things. I tried putting an ajax call in the calendar component but that didn't cause it to execute the setter. I very easily could have coded it wrong though.

Here is the command button:

 
Ray Clark
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I found the problem. I should have had an ajax call.





I don't think that it was calling the setter because the calendar wasn't in the same form as the submit button. I had tried ajax calls that I found online but I think the API changed, I found the documentation to version 5 which we are using that that spelled out exactly what I needed to do.

Thank you for your help.
 
Tim Holloway
Saloon Keeper
Posts: 28770
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 haven't tried to decode that in detail, but the rules themselves are simple:

1. When you submit via a commandButton or commandLink, all input controls in the form that contains that command control are submitted, and only those controls. No other forms participate.

2. When you attach an AJAX action to an input control, the default scope is to only submit that one control and no other input controls in the form that contains that control. You can, of course, expand that scope if you like.

3. Regardless, whatever input controls are submitted go through the standard lifecycle process; they're validated, and if valid, their corresponding backing bean properties are updated and the action/listener fired. If ANY of the submitted inputs are invalid the update and fire stages are bypassed. If you have invalid inputs on a form, but they aren't among the selected controls to submit on an AJAX submit, they won't be submitted, validated, or updated and therefore won't affect how the selected input controls are processed.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic