myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Henry Eduardo Iguaro" <henry.edua...@gmail.com>
Subject How to intercept client side validation message
Date Fri, 22 Feb 2008 18:31:54 GMT
Hi again

I need to capture the client-side validation message (of course at client
side), i need to write the message in a custom javascript rendered message
component, here's the code of my test page

<?xml version="1.0" encoding="UTF-8" ?>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://myfaces.apache.org/trinidad" prefix="tr" %>
<%@ taglib uri="http://myfaces.apache.org/trinidad/html" prefix="trh" %>
<%@ taglib uri="http://sudeban.gob.ve/jsf/component/tags" prefix="sudeban"
%>

<f:view>

<trh:head>
</trh:head>

<trh:body>
    <tr:form>
        <f:verbatim><br/></f:verbatim>
        <tr:inputText simple="true" id="input1" required="true"
showRequired="false" value="#{usuarioBackingBean.usuario.nombre}">
            <tr:validateLength maximum="32" minimum="9"
messageDetailExact="User name should be at least 9 letters and not more than
32" />
        </tr:inputText>
        <sudeban:balloon-message for="input1" /> <!-- THIS COMPONENT IS
WHERE I WANT TO PUT THE CLIENT VALIDATION MESSAGE -->
        <f:verbatim><br/></f:verbatim>
        <f:verbatim><br/></f:verbatim>
        <tr:commandButton onclick="alert('a')" id="btnLoggin" text="Access"
action="#{usuarioBackingBean.login}" />
    </tr:form>
</trh:body>

</f:view>

Is there a way i can capture the error message?

Also when i click on the commandButton the alert does not show, and the
message of tr:validateLength is ignored... It shows the same message for
both dimensions when either of them are wrong

(I really want to use jsf, so i switched to Trinidad, only because it has
client-side validations, has sun ever thought how important
client-validation is when the first jsf version came out?, i know this
comment is out of context but...)

Please, can somebody help me or at least give me a hint of what i have to
do?

Thanks

-- 
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/O G++@ s-:+>:+ a25 tv+ d++> t+ C+++>+ U++>+++ P+ L++>+++ W+++ E---- w++$
5 X R-@ b+>++ D+ e>++ o? O? h--@ r+ y++ K? M PS+
------END GEEK CODE BLOCK------

Mime
View raw message