I have selectonemenu and i want when i change the value of selectonemenu i want that the bean value updated for to display some code that i have in a block condition without submitting and refreshing the page without this i will lose the other value fill in the form
I have none display
I have selectonemenu block
<h:selectOneMenu id="categorieSelect" value = "#{categorie.option}"
valueChangeListener="#{categorie.categorieChanged}">
<f:selectItem itemValue="selection" itemLabel="Choisissez une catégorie" noSelectionOption="true"/>
<f:selectItems value ="#{categorie.options}" var="categorieSelect" />
<f:ajax event="change" execute="#form"/></h:selectOneMenu>
I have also some block in c:choose which i want to display when the value of selectonemenu change
<c:choose>
<c:when test="#{categorie.option == 'offreemploi'}">
<div class="row">
<p:outputLabel value="Type d'annonce *" class="outputelement" id="test3"></p:outputLabel>
</div>
<div class="row">
<h:selectOneRadio id="typeannonce" required="#{not empty param[menucategorie.clientId]}"
requiredMessage="Le type d'annonce est obligatoire"
class="inputelement"
value="#{offreEmploi.typeannonce}" binding="#{typeannonce}">
<f:selectItem itemValue="demande" itemLabel="Demande (Vous recherchez un emploi)"
/>
<f:selectItem itemValue="offre" itemLabel="Offre (Vous recherchez un employé)" />
</h:selectOneRadio>
</div>
<div class="row">
<h:message for="typeannonce" class="message col-xs-12 col-sm-6 col-md-6 col-lg-6"/>
</div>
<div class="row">
<h:outputText value="Intitulé du poste *" class="outputelement"></h:outputText>
</div>
<div class="row">
<h:inputText id="intituleposte" binding="#{intituleposte}" required="#{not empty param[menucategorie.clientId]}"
requiredMessage="L'intitule du poste est obligatoire"
class="col-xs-12 col-sm-6 col-md-6 col-lg-6 inputelement"
value="#{offreEmploi.intituleposte}"></h:inputText>
</div>
<div class="row">
<h:message for="intituleposte" class="message col-xs-12 col-sm-6 col-md-6 col-lg-6"/>
</div>
<div class="row">
<h:outputText value="Description du poste *" class="outputelement"></h:outputText>
</div>
<div class="row">
<h:inputTextarea id="descriptionposte" rows="10" cols="30" binding="#{descriptionposte}" required="#{not empty param[menucategorie.clientId]}"
requiredMessage="La description du poste est obligatoire"
class="col-xs-12 col-sm-6 col-md-6 col-lg-6 inputelement"
value="#{offreEmploi.descriptionposte}"></h:inputTextarea>
</div>
<div class="row">
<h:message for="descriptionposte" class="message col-xs-12 col-sm-6 col-md-6 col-lg-6"/>
</div>
<div class="row">
<h:outputText class="outputelement" value="Photos : Une annonce avec photos est beaucoup plus consulté qu'une annonce sans photos"></h:outputText>
</div>
<div class="row">
<h:outputText class="outputelement" value="Photo principal"></h:outputText>
<p:fileUpload mode="simple" class="inputelement"
value="#{photo.photo1}" binding="#{photo1}"/>
</div>
<div class="row">
<h:outputText class="outputelement" value="Photo 2"></h:outputText>
<p:fileUpload mode="simple" class="inputelement"
value="#{photo.photo2}" binding="#{photo2}"/>
</div>
<div class="row">
<h:outputText class="outputelement" value="Photo 3"></h:outputText>
<p:fileUpload mode="simple" class="inputelement"
value="#{photo.photo3}" binding="#{photo3}"/>
</div>
</c:when>
<c:otherwise>Bonjour</c:otherwise>
</c:choose>
and here is my backing bean
#ManagedBean
#SessionScoped
public class Categorie implements Serializable{
String option; // +getter +setter
List<SelectItem> options; // +getter
public String getOption() {
return option;
}
public void setOption(String selectedOption) {
this.option = selectedOption;
}
public List<SelectItem> getOptions() {
return options;
}
public void setOptions(List<SelectItem> options) {
this.options = options;
}
public void categorieChanged(ValueChangeEvent e) {
//assign new value to country
option = e.getNewValue().toString();
}
public void changeCountry() {
//System.out.println("Selected country is: " + option.);
}
public Categorie() {
options = new ArrayList<SelectItem>();
SelectItemGroup group1 = new SelectItemGroup("EMPLOI");
group1.setSelectItems(new SelectItem[] {
new SelectItem("offreemploi", "Offre d'emploi")
});
options.add(group1);
}
public void save(){
}
}
This question already has an answer here:
when i click on the p:selectBooleanCheckbox, it works but for the second click it doesn't work,why?
(1 answer)
Closed 5 years ago.
when i want to update the value of the <p:selectBooleanCheckbox> and click on update button, its value doesn't change on the database, but when i replace it with .
this is my code :
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
xmlns:evoice="http://ccs.tn/taglib/evoice">
<ui:include src="CloseTicketDialog.xhtml" />
<div class="form-body pal">
<div class="row">
<p:outputLabel for="call_from_tel_number"
styleClass="col-md-2 control-label" value="Numéro Entrant" />
<div class="col-md-3">
<div class="input-icon right">
<i class="fa fa-phone" />
<p:inputText id="call_from_tel_number" maxlength="32" size="9"
value="#{ticketController.ticket.callFromTelNumber}"
validatorMessage="Numéro Entrant : Composé au minimum par 8 chiffres dans [0..9]."
styleClass="form-control">
<f:validateRegex pattern="[0-9\s]*" />
<f:validateLength minimum="8" maximum="32" />
<p:ajax event="blur" id="ajax_call" disabled="#{ticketController.ticket.ticketId ne null}"
process="call_from_tel_number,form:growl"
update="form:growl,form:tab_view:lastName, form:tab_view:firstName"
listener="#{ticketController.queryOldTickets(ticketController.ticket)}"
onstart="PF('statusDialog').show()"
oncomplete="PF('statusDialog').hide()"/>
</p:inputText>
</div>
</div>
<p:outputLabel for="reply_to_tel_number" value="Deuxièmme Numéro"
styleClass="col-md-3 control-label" />
<div class="col-md-3">
<div class="input-icon right">
<i class="fa fa-phone" />
<p:inputText id="reply_to_tel_number" maxlength="32" size="9"
readonly="{ticketController.ticket.ticketId ne null}"
value="#{ticketController.ticket.otherPhonenum}"
validatorMessage="Deuxièmme Numéro : Accepte seulement des chiffres dans [0..9]."
styleClass="form-control">
<f:validateRegex pattern="[0-9]*" />
</p:inputText>
</div>
</div>
</div>
<div class="form-group" />
<div class="row">
<p:outputLabel for="telOwner" value="proprietaire de num"
styleClass="col-md-2 control-label" />
<div class="col-md-3">
<div class="input-icon right">
<p:selectBooleanCheckbox selected="true" id="telOwner" value="#{ticketController.ticket.phoneLineOwner}" />
</div>
</div>
</div>
what is the problem? what the value of "telOwner" is updated when i use p:inputText and its not updated when i use p:selectBooleanCheckbox?
this is the controller:
#Controller(value = "ticketController")
#Scope("view")
public class TicketController extends eVoiceController implements Serializable {
public String saveTicket() {
log.info("saveTicket");
if (!isValide(ticket)) {
return null ;
}
if (ticket.getOwner() == null) {
ticket.setOwner(currentUser());
} else {
ticket.setLastUpdateBy(currentUser());
ticket.setLastUpdateDate(new Timestamp(System.currentTimeMillis()));
}
Integer ticketId = ticketService.saveTicket(ticket);
// ticket.getTicketCategories().size();
if (closeTicketCmdBtn != null) {
closeTicketCmdBtn.setDisabled(false);
}
showInfoMessage(i18n("ticket.saved.number", ticketId));
log.info("TICKET[" + ticketId + "]");
return null;
}
this is the service:
#Override
#Transactional(readOnly = false)
public Integer saveTicket(final Ticket ticket) {
LoyaltyCard card = ticket.getLoyaltyCard();
if (card != null) {
card.setCreatedBy(ticket.getCreatedBy());
card = loyaltyCardService.save(card);
}
ticket.setLoyaltyCard(card);
Integer id = ticketDao.save(ticket).getTicketId();
/**
* #TODO run on seperate Thread
*/
ruleService.assignSeverity(ticket);
return id;
}
and this is the entity code:
#Column(name = "phone_line_owner")
#org.hibernate.annotations.Type(type = "yes_no")
private Boolean phoneLineOwner;
I am new to JSF and I am working on an application where a group of parameters placed in a datagrid can be either added or removed. Below is the initial level of screenshot:
When I click on RemoveInvoice of any of the existing list, the list present after that box should automatically take the position of the removed list. But in my case, a blank section is getting displayed as per the below screenshot:
My jsf code looks like:
<div class="listing_Table">
<p:dataGrid columns="3" layout="grid" id="addInvoicePanel"
value="#{hrOrganizationPaymentDetailBean.invoiceDetailTOList}"
var="invoiceDetail">
<p:panelGrid rendered="#{!invoiceDetail.delete}">
<div class="Table">
<div class="Row">
<div class="Cell">
<p:outputLabel>
<span class="redColor">*</span>InvoiceType:</p:outputLabel>
</div>
<div class="Cell">
<p:selectOneMenu value="#{invoiceDetail.invoiceTypeID}"
filter="true" filterMatchMode="contains" required="true"
requiredMessage="InvoiceType is required">
<f:selectItems
value="#{hrOrganizationPaymentDetailBean.newInvoiceTypeList}"
var="list" itemValue="#{list.typeId}"
itemLabel="#{list.type}" />
</p:selectOneMenu>
</div>
</div>
<div class="Row">
<div class="Cell">
<p:outputLabel>
<span class="redColor">*</span>InvoiceNumber:</p:outputLabel>
</div>
<div class="Cell">
<p:inputText value="#{invoiceDetail.invoiceNumber}"
required="true" requiredMessage="InvoiceNumber is required" />
</div>
</div>
<div class="Row">
<div class="Cell">
<p:outputLabel>
<span class="redColor">*</span>InvoiceAmount:</p:outputLabel>
</div>
<div class="Cell">
<p:inputText value="#{invoiceDetail.invoiceAmount}"
required="true" requiredMessage="InvoiceAmount is required">
<f:convertNumber pattern="#0.00" />
</p:inputText>
</div>
</div>
<div class="Row">
<div class="Cell">
<p:outputLabel>InvoicePath:</p:outputLabel>
</div>
<div class="Cell">
<p:inputText value="#{invoiceDetail.invoicePath}" />
</div>
</div>
<div class="Row">
<div class="Cell">
<p:outputLabel>
<span class="redColor">*</span>InvoiceDate:</p:outputLabel>
</div>
<div class="Cell">
<p:calendar id="invoiceDate"
value="#{invoiceDetail.invoiceDate}" showOn="button"
readonlyInput="true" timeZone="IST" pattern="dd-MMM-yyyy"
required="true" requiredMessage="InvoiceDate is required" />
</div>
</div>
<div class="Row">
<div class="Cell">
<p:outputLabel value="ServiceTax:" />
</div>
<div class="Cell">
<p:inputText value="#{invoiceDetail.serviceTax}">
<f:convertNumber pattern="#0.00" />
</p:inputText>
</div>
</div>
<div class="Row">
<div class="Cell">
<p:outputLabel value="TDS:" />
</div>
<div class="Cell">
<p:inputText value="#{invoiceDetail.tDS}">
<f:convertNumber pattern="#0.00" />
</p:inputText>
</div>
</div>
<div class="Row">
<div class="Cell"></div>
<div class="Cell">
<p:commandButton styleClass="Submit_button"
value="Remove Invoice"
action="#{hrOrganizationPaymentDetailController.removeInvoiceDetail(invoiceDetail)}"
update=":EditOrganizationPaymentDetailForm:addInvoicePanel" />
</div>
</div>
</div>
</p:panelGrid>
</p:dataGrid>
</div>
And my backend java code is:
public void removeInvoiceDetail(InvoiceDetailTO invoiceDetailTO)
{
List<InvoiceDetailTO> invoiceDetailTOList = null;
List<Long> deletedInvoiceDetail = null;
try {
invoiceDetailTOList = hrOrganizationPaymentDetailBean.getInvoiceDetailTOList();
deletedInvoiceDetail = hrOrganizationPaymentDetailBean.getDeletedInvoiceDetailID();
if (deletedInvoiceDetail != null && !deletedInvoiceDetail.isEmpty()) {
} else {
deletedInvoiceDetail = new ArrayList<Long>();
}
for (InvoiceDetailTO detailTO : invoiceDetailTOList) {
if ((detailTO.getInvoiceDetailID() != null && detailTO.getInvoiceDetailID().equals(invoiceDetailTO.getInvoiceDetailID()))
|| (detailTO.getUniqueID() != null && detailTO.getUniqueID().equals(invoiceDetailTO.getUniqueID()))) {
detailTO.setDelete(true);
if (invoiceDetailTO.getInvoiceDetailID() != null) {
deletedInvoiceDetail.add(invoiceDetailTO.getInvoiceDetailID());
}
}
}
hrOrganizationPaymentDetailBean.setInvoiceDetailTOList(invoiceDetailTOList);
hrOrganizationPaymentDetailBean.setDeletedInvoiceDetailID(deletedInvoiceDetail);
} catch (Exception e) {
LOGGER_.error("", e);
}
}
Please advise where I am making a mistake?
The problem is in <p:panelGrid rendered="#{!invoiceDetail.delete}">. Even with rendered="false" cell won't be removed from html page after rendering. If you open debugger in your browser (press F12 for Mozilla or Chrome) you can find empty cell there <td class="ui-datagrid-column"></td>. So you need to remove deleted item from your #{hrOrganizationPaymentDetailBean.invoiceDetailTOList} and update dataGrid.
I am creating a Icefaces Datatable.First column have radio button. On clicking of radio button of first row i am able to edit the row. On clicking of radio button of another rows another operation should be performed(but not edit). I have one command button at the bottom of the datatable which saves the data. Find below the code for the same
------------------xhtml----------------------
<h1>IceFaces 3 </h1>
<h:form>
<ice:selectOneRadio id="myRadioId"
value="#{order.checked}" layout="spread"
valueChangeListener="#{orderBean.editSelectedRow}"
partialSubmit="true">
<f:selectItem itemValue="" />
</ice:selectOneRadio>
<ace:dataTable value="#{orderBean.orderList}" var="o" style="width: 300px !important">
<ace:column headerText="Select">
<ice:radio for="myRadioId" />
</ace:column>
<ace:column headerText="Order No">
<h:inputText value="#{o.orderNo}" size="10" rendered="#{o.editable}" />
<h:outputText value="#{o.orderNo}" rendered="#{not o.editable}" />
</ace:column>
<ace:column headerText="Product Name">
<h:inputText value="#{o.productName}" size="20" rendered="#{o.editable}" />
<h:outputText value="#{o.productName}" rendered="#{not o.editable}" />
</ace:column>
<ace:column headerText="Price">
<h:inputText value="#{o.price}" size="10" rendered="#{o.editable}" />
<h:outputText value="#{o.price}" rendered="#{not o.editable}" />
</ace:column>
<ace:column headerText="Quantity">
<h:inputText value="#{o.qty}" size="5" rendered="#{o.editable}" />
<h:outputText value="#{o.qty}" rendered="#{not o.editable}" />
</ace:column>
</ace:dataTable>
<br/><br/>
<ice:commandButton value="Save Changes" action="#{orderBean.saveAction}" />
</h:form>
</h:body>
------------------------------managed bean------------------------------
//bean
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.component.UIComponent;
import javax.faces.component.html.HtmlDataTable;
import javax.faces.event.ActionEvent;
import javax.faces.event.ValueChangeEvent;
import org.icefaces.ace.component.datatable.DataTable;
#ManagedBean(name="orderBean")
#SessionScoped
public class OrderBean implements Serializable{
private static final long serialVersionUID = 1L;
private static final ArrayList<Order> orderList =
new ArrayList<Order>(Arrays.asList( new Order("A0001", "Intel CPU", new BigDecimal("700.00"), 1),
new Order("A0002", "Harddisk 10TB", new BigDecimal("500.00"), 2),
new Order("A0003", "Dell Laptop", new BigDecimal("11600.00"), 8),
new Order("A0004", "Samsung LCD", new BigDecimal("5200.00"), 3),
new Order("A0005", "A4Tech Mouse", new BigDecimal("100.00"), 10)
));
public ArrayList<Order> getOrderList() {
return orderList;
}
public String saveAction() {
//get all existing value but set "editable" to false
for (Order order : orderList){
order.setEditable(false);
}
//return to current page
return null;
}
// listener method
public void editSelectedRow(ValueChangeEvent evt) {
// We get the table object
DataTable table = getParentDatatable((UIComponent) evt.getSource());
if(table==null) return;
// We get the object on the selected line.
Object o = table.getRowData();
Order order = (Order)o;
// Eventually, if you need the index of the line, simply do:
int index = table.getRowIndex();
if(index == 0){
order.setEditable(true);
}
// ...
}
// Method to get the DataTable.
private DataTable getParentDatatable(UIComponent compo) {
if (compo == null) {
return null;
}
if (compo instanceof DataTable) {
return (DataTable) compo;
}
return getParentDatatable(compo.getParent());
}
//managed bean
#ManagedBean(name="order")
public static class Order{
String orderNo;
String productName;
BigDecimal price;
int qty;
boolean editable;
boolean checked;
public Order(){ }
public Order(String orderNo, String productName, BigDecimal price, int qty) {
this.orderNo = orderNo;
this.productName = productName;
this.price = price;
this.qty = qty;
}
//getter and setter methods
public String getOrderNo() {
return orderNo;
}
public void setOrderNo(String orderNo) {
this.orderNo = orderNo;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
public int getQty() {
return qty;
}
public void setQty(int qty) {
this.qty = qty;
}
public boolean isEditable() {
return editable;
}
public void setEditable(boolean editable) {
this.editable = editable;
}
public boolean isChecked() {
return checked;
}
public void setChecked(boolean checked) {
this.checked = checked;
}
}
}
-------------------------------generated html--------------------------------
<table>
<thead>
<tr>
<th class="ui-widget-header"><div
class="ui-header-column clickable" id="j_idt6:j_idt9:j_idt10">
<span><span class="ui-header-text"
id="j_idt6:j_idt9:j_idt10_text">Select</span></span>
</div></th>
<th class="ui-widget-header"><div
class="ui-header-column clickable" id="j_idt6:j_idt9:j_idt12">
<span><span class="ui-header-text"
id="j_idt6:j_idt9:j_idt12_text">Order No</span></span>
</div></th>
<th class="ui-widget-header"><div
class="ui-header-column clickable" id="j_idt6:j_idt9:j_idt15">
<span><span class="ui-header-text"
id="j_idt6:j_idt9:j_idt15_text">Product Name</span></span>
</div></th>
<th class="ui-widget-header"><div
class="ui-header-column clickable" id="j_idt6:j_idt9:j_idt18">
<span><span class="ui-header-text"
id="j_idt6:j_idt9:j_idt18_text">Price</span></span>
</div></th>
<th class="ui-widget-header"><div
class="ui-header-column clickable" id="j_idt6:j_idt9:j_idt21">
<span><span class="ui-header-text"
id="j_idt6:j_idt9:j_idt21_text">Quantity</span></span>
</div></th>
</tr>
</thead>
<tbody class="ui-datatable-data ui-widget-content">
<tr class=" ui-datatable-even " id="j_idt6:j_idt9_row_0" tabindex="0">
<td>
<span>
<input id="j_idt6:myRadioId:_0"
name="j_idt6:myRadioId" onblur="setFocus('');"
onclick=";setFocus('');iceSubmitPartial(form, this, event);"
onfocus="setFocus(this.id);"
onkeypress="Ice.util.radioCheckboxEnter(form,this,event);"
type="radio" value="" />
<label class="iceSelOneRb" for="j_idt6:myRadioId:_0"></label>
</span>
</td>
<td><span id="j_idt6:j_idt9:0:_t14">A0001</span></td>
<td><span id="j_idt6:j_idt9:0:_t17">Intel CPU</span></td>
<td><span id="j_idt6:j_idt9:0:_t20">700.00</span></td>
<td><span id="j_idt6:j_idt9:0:_t23">1</span></td>
</tr>
<tr class=" ui-datatable-odd " id="j_idt6:j_idt9_row_1" tabindex="0">
<td>
<span>
<input id="j_idt6:myRadioId:_0"
name="j_idt6:myRadioId" onblur="setFocus('');"
onclick=";setFocus('');iceSubmitPartial(form, this, event);"
onfocus="setFocus(this.id);"
onkeypress="Ice.util.radioCheckboxEnter(form,this,event);"
type="radio" value="" />
<label class="iceSelOneRb" for="j_idt6:myRadioId:_0"></label>
</span>
</td>
<td><span id="j_idt6:j_idt9:1:_t14">A0002</span></td>
<td><span id="j_idt6:j_idt9:1:_t17">Harddisk 10TB</span></td>
<td><span id="j_idt6:j_idt9:1:_t20">500.00</span></td>
<td><span id="j_idt6:j_idt9:1:_t23">2</span></td>
</tr>
<tr class=" ui-datatable-even " id="j_idt6:j_idt9_row_2" tabindex="0">
<td>
<span>
<input id="j_idt6:myRadioId:_0"
name="j_idt6:myRadioId" onblur="setFocus('');"
onclick=";setFocus('');iceSubmitPartial(form, this, event);"
onfocus="setFocus(this.id);"
onkeypress="Ice.util.radioCheckboxEnter(form,this,event);"
type="radio" value="" />
<label class="iceSelOneRb" for="j_idt6:myRadioId:_0"></label>
</span>
</td>
<td><span id="j_idt6:j_idt9:2:_t14">A0003</span></td>
<td><span id="j_idt6:j_idt9:2:_t17">Dell Laptop</span></td>
<td><span id="j_idt6:j_idt9:2:_t20">11600.00</span></td>
<td><span id="j_idt6:j_idt9:2:_t23">8</span></td>
</tr>
<tr class=" ui-datatable-odd " id="j_idt6:j_idt9_row_3" tabindex="0">
<td>
<span>
<input id="j_idt6:myRadioId:_0"
name="j_idt6:myRadioId" onblur="setFocus('');"
onclick=";setFocus('');iceSubmitPartial(form, this, event);"
onfocus="setFocus(this.id);"
onkeypress="Ice.util.radioCheckboxEnter(form,this,event);"
type="radio" value="" />
<label class="iceSelOneRb" for="j_idt6:myRadioId:_0"></label>
</span>
</td>
<td><span id="j_idt6:j_idt9:3:_t14">A0004</span></td>
<td><span id="j_idt6:j_idt9:3:_t17">Samsung LCD</span></td>
<td><span id="j_idt6:j_idt9:3:_t20">5200.00</span></td>
<td><span id="j_idt6:j_idt9:3:_t23">3</span></td>
</tr>
<tr class=" ui-datatable-even " id="j_idt6:j_idt9_row_4" tabindex="0">
<td>
<span>
<input id="j_idt6:myRadioId:_0"
name="j_idt6:myRadioId" onblur="setFocus('');"
onclick=";setFocus('');iceSubmitPartial(form, this, event);"
onfocus="setFocus(this.id);"
onkeypress="Ice.util.radioCheckboxEnter(form,this,event);"
type="radio" value="" />
<label class="iceSelOneRb" for="j_idt6:myRadioId:_0"></label>
</span>
</td>
<td><span id="j_idt6:j_idt9:4:_t14">A0005</span></td>
<td><span id="j_idt6:j_idt9:4:_t17">A4Tech Mouse</span></td>
<td><span id="j_idt6:j_idt9:4:_t20">100.00</span></td>
<td><span id="j_idt6:j_idt9:4:_t23">10</span></td>
</tr>
</tbody>
</table>
probleme here is that i am unable to call editSelectedRow(ValueChangeEvent evt) method of OrderBean.java
I think what you are missing is the onchange property , do something like the following :
<ice:selectOneRadio id="myRadioId"
value="#{order.checked}" layout="spread"
valueChangeListener="#{orderBean.editSelectedRow}"
onchange="submit()">
<f:selectItem itemValue="" />
</ice:selectOneRadio>
Hope that Helps.
i have a datatable, each row has a
<p:commandButton styleClass="edit-promo-img" action="#{branchController.prepareEdit}" value="" oncomplete="updateBranchForm()"/>
this is my modal:
<div id="edit-branch-modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<h:form id="editBranchForm">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
Branch Details
</div>
<div class="modal-body">
<div><h:outputLabel value="#{bundle.CreateBranchLabel_name}" for="name" /></div>
<div><h:inputText id="name" value="#{branchController.selected.name}" title="#{bundle.CreateBranchTitle_name}" required="true" requiredMessage="#{bundle.CreateBranchRequiredMessage_name}"/></div>
</div>
<div class="modal-footer">
<p:commandButton action="#{branchController.update}" value="#{bundle.CreateBranchSaveLink}" />
<button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button>
</div>
<p:remoteCommand name="updateBranchForm" update="#form" />
</h:form>
prepareEdit method:
public void prepareEdit() {
current = (Branch) getItems().getRowData();
selectedItemIndex = pagination.getPageFirstItem() + getItems().getRowIndex();
}
selected method:
public Branch getSelected() {
if (current == null) {
current = new Branch();
selectedItemIndex = -1;
}
return current;
}
when i debugged on the getSelected method, there is actually correct data on my "current" object.
my problem is, the input in the modal has no data.
using JSF 2.0 with Primefaces and my bean is using ViewScope.