voyent
ace:dataTable row / cell editing, Issue with Validation Message  XML
Forum Index -> Development Build Feedback
Author Message
u_milind

Joined: 16/Apr/2007 00:00:00
Messages: 10
Offline


I am using ace:dataTable with row / cell editing feature.

Row becomes editable after selecting the pencil icon. When invalid value is entered for the column cell having validator, the validation is performed properly. However, it is expected that the error mesaage should be displayed immediately after checkmark icon is clicked to accept the row changes which is not functioning (the message is not displayed).

I am using ICEfaces-3.0.0.RC2. If required I can provide the complete sample code.

Below is the code snippet, (Error message for <f:validateLength minimum="5" maximum="20" /> is not getting rendered)

I shall appreciate if IceFaces team can guide me quickly on the SOS issues.

Regards,
Milind

Code:
         <h:form id="form1">
             <ice:messages style="color:red" />
             <br/>            
 
             <ace:dataTable id="testDataTable" value="#{testManagedBean.contacts}" var="contact">
                 <ace:column headerText="Name">
                     <ace:cellEditor>
                         <f:facet name="output">
                             <h:outputText value="#{contact.contactName}"/>
                         </f:facet>
                         <f:facet name="input">
                             <h:inputText id="idContactName" value="#{contact.contactName}"> 
                                 <f:validateLength minimum="5" maximum="20" />                               
                             </h:inputText>
                         </f:facet>                        
                     </ace:cellEditor>
                 </ace:column>
                 <ace:column headerText="Options">
                     <ace:rowEditor rowEditListener="#{testManagedBean.testRowEditEvent}"/> 
                 </ace:column>
             </ace:dataTable>
 
             <br/>
             <h:commandButton type="submit" value="Save" action="#{testManagedBean.actionSave()}" />
 
         </h:form>
 
anupchandratre

Joined: 24/Feb/2011 08:14:20
Messages: 6
Offline


Your all error messages should be displayed at top of the page, so try removing this line <ice:messages style="color:red" />

And try adding <ice:messages for="idContactName"/> wherever you want to display error message for that input box
u_milind

Joined: 16/Apr/2007 00:00:00
Messages: 10
Offline


I tried your suggestion. However, the row level validation happens on clicking checkmark icon of the editing row but the error message is not displayed on invalid input.

The validations (triggers) "before" and "after" row / cell editing on dataTable component will be of great help. IceFaces may incorporate these features appropriately.

Milind
amkiranv

Joined: 27/Aug/2010 01:45:19
Messages: 4
Offline


hii
am working on ace:datatable on cell edit am not getting the updated value to update in bean any solution to fix it thnz in advance
evgheni.sadovoi

Joined: 22/Aug/2011 11:28:32
Messages: 99
Offline


You don't see your messages because the <ace:rowEditor/> is doing a ROW level AJAX submit and work similar to the <f:ajax execute="@this" render="@this">

A bit of documentation:
(http://wiki.icesoft.org/display/ICE/DataTable)

ace:dataTable support following client behaviors:

editStart:
- Fired during the display of row edit input fields, by default, execute @none, render @none.
editSubmit:
- Fired during the execute and hiding of row edit input fields, by default, execute @none, render @none. The execute and render of this event are controlled by the component to correctly submit the edit controls of this row without executing anything else.
editCancel:
-Fired during the hiding of row edit input fields, by default, execute @none, render @none. The execute and render of this event are controlled by the component to correctly reset the edit controls of this row without executing anything else.

Most likely you will need to add something like this to your datatable in order to update your messages:

<ace:ajax render="myMessages" event="editSubmit"/>

I would also recommend to use <h:messages id="myMessages"> instead of ice:messages.

And on the final note you should really stick to the ACE + regular JSF 2.0 components if you use them in your NEW application. Most of the future enhancements and upgrades will be applied to this new suite. (source: http://icefaces-showcase.icesoft.org/showcase.jsf).
ICE components can be leveraged if you are planning to upgrade your older application written for JSF 1.2 and ICEfaces 1.8.2 frameworks into JSF 2.0 and ICEfaces 3.0.
jo9999ki

Joined: 24/May/2012 02:56:49
Messages: 1
Offline


Can you please provide a code sample with
<ace:ajax ...
<ace:roweditor ...

and a serverside bean

We had a look to all the documentation but received no response on a serverside method

Kind Regards

J. Kirchner
meerlady

Joined: 25/Apr/2007 00:00:00
Messages: 1
Offline


u_milind wrote:


I have the same Problem with ace:dataTable, ace:roweditor and Validation Message (the message is not displayed).

Did you find a Solution?

I am using IceFaces 3.2.0

betrand

Joined: 09/Oct/2012 15:10:16
Messages: 2
Offline


Write a validator Method or Class and use
Then on your page use validator E.G.

<ace:column id="lenght">
<ace:cellEditor>
<f:facet name="output">
<ice:outputText id="heightout" value="#{it.height}" style="width:60px;font-weight: bold;" />
</f:facet>
<f:facet name="input">
<ice:inputText id="heightIn" value="#{it.height}" style="width:40px;" validator="#{validator.validateWidthAndHeight}">
</ice:inputText>
<ice:message for="heightIn" styleClass="errorMessage"/>
</f:facet>
</ace:cellEditor>
</ace:column>
betrand

Joined: 09/Oct/2012 15:10:16
Messages: 2
Offline


The above should validate the cell where the error is and display a validation message on that cell on ajax callback.

Your Validator Bean and Method May look like this below:

package web;

import java.util.List;
import javax.enterprise.context.RequestScoped;
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.component.UIInput;
import javax.faces.context.FacesContext;
import javax.faces.validator.ValidatorException;
import javax.inject.Named;

/**
*
* @author betrand
*/
@Named(value = "validator")
@RequestScoped
public class InputValidator {

private String stringInputToValidate;
private Integer integerInputToValidate;

/**
* Creates a new instance of InputValidator
*/
public InputValidator() {
}


public void validateWidthAndHeight(FacesContext facesContext, UIComponent component, Object value) throws ValidatorException {
stringInputToValidate = value.toString();
if (stringInputToValidate.equals("")) {
((UIInput) component).setValid(false);
FacesMessage facesmessage = new FacesMessage("Value is required.");
facesContext.addMessage(component.getClientId(facesContext), facesmessage);
return;
} else {
try {
integerInputToValidate = Integer.parseInt(stringInputToValidate);
if (integerInputToValidate > 2500) {
((UIInput) component).setValid(false);
FacesMessage facesmessage = new FacesMessage("Invalid Value!!! Value must be less than 2500 ");
facesContext.addMessage(component.getClientId(facesContext), facesmessage);
return;
}
if (integerInputToValidate < 200) {
((UIInput) component).setValid(false);
FacesMessage facesmessage = new FacesMessage("Invalid Value!!! Value must be greater than 200 ");
facesContext.addMessage(component.getClientId(facesContext), facesmessage);
return;
}
} catch (Exception e) {
logException(e);
((UIInput) component).setValid(false);
FacesMessage facesmessage = new FacesMessage("Invalid Value!!!");
facesContext.addMessage(component.getClientId(facesContext), facesmessage);
return;
}
}
}
 
Forum Index -> Development Build Feedback
Go to:   
Powered by JForum 2.1.7ice © JForum Team