• Post Reply Bookmark Topic Watch Topic
  • New Topic

Dialog inside Datatable with button displays wrong variable value  RSS feed

 
Raymond Self
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a bookings table where customers can view their bookings and in the table there is a button with a command button that onclick goes to the dialogue to display the variable petUpdate value but if you have 2 bookings then all the update buttons display the value of the last petUpdate in the arrayList can anyone help with this thanks

DataTable with the button


Code in the above datatable.......The commented out output label displays the correct value for each but when the button is clicked the dialog only displays the last ones value
 
Tim Holloway
Bartender
Posts: 18713
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should not attempt to define a dialog within a form control such as a dataTable. Define a separate form for the dialog (for maximum IE compatability, define it first).

Forms may not be embedded, either the original HTML version or the JSF version.

Also, this is not proper JSF EL usage:



A value attribute is supposed to reference a property,, not invoke a method. The proper coding would be:



Which would allow JSF to invoke getPetUpdate() for you.

The other way is bad practice for output, but it would be fatal for input controls, since it allows no way of invoking the corresponding setPetUpdate method when the form is submitted. JSF knows whether to call the get or set method when you do a proper property reference.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!