Forums de discussion
f:validateRegex
Rico D'Amore, modifié il y a 11 années.
f:validateRegex
New Member Publications: 13 Date d'inscription: 29/03/12 Publications récentes
Hello,
I have a f:validateRegex tag that I can't seem to get working. Below I will post: you will see a validator message that I have commented out, it is part of the process, I have tried with and without the message. I'm wondering if anyone can see something wrong with the way I have written it. I can see in the server log that the validation is taking place but I get no posted message on the page; with or without the validator message. In other words the default message is not posting either. Without the proper email format the form will not submit so I know that it is working, just not producing my desired message. It works perfectly with a correctly formatted email.
any suggestions would be great! thank you.
<?xml version="1.0" encoding="UTF-8"?>
<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ice="http://www.icesoft.com/icefaces/component"
xmlns:icecore="http://www.icefaces.org/icefaces/core"
xmlns:liferay-ui="http://portletfaces.org/liferayfaces/liferay-ui"
xmlns:liferay-util="http://portletfaces.org/liferayfaces/liferay-util"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:aui="http://portletfaces.org/alloyfaces/aui"
>
<h:body>
<f:view>
<ice:panelGroup style="background-color: #64A8D1; color: #FFFFFF; padding: 9px; border: 2px solid #03436A; margin-bottom: 4px;">
<h2>Join TagMyVideo! ***</h2>
</ice:panelGroup>
<ice:outputStyle href="/css/rime-portlet.css"/>
<h:form>
<ice:panelGroup style=" color: #FFFFFF; padding: 9px; font-size: 15px; border: 2px solid #03436A;">
<ice:outputText value="First Name" style="margin-right: 4px;"/>
<ice:inputText id="fistName" required="true" value="#{kidController.kidFirstName}" style="margin-bottom: 4px;"/>
<br/>
<ice:outputText value="Last Name" style="margin-right: 5px;"/>
<ice:inputText id="lastName" required="true" value="#{kidController.kidLastName}" style="margin-bottom: 4px;"/>
<br/>
<ice:outputText value="Email" style="margin-right: 40px;" />
<ice:inputText id="email" required="true" value="#{kidController.kidEmail}" style="padding: 4px;
margin-bottom: 4px;">
<!-- validatorMessage="#{kidController.kidEmail} is not a valid email address pleas try again!">-->
<f:validateRegex pattern="^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,6})$" />
</ice:inputText>
<br/>
<h:outputLabel value="Age:" style="margin-bottom: 4px; padding: 4px;"/>
<h:selectOneRadio layout="pageDirection" value="#{kidController.kidAge}" style="padding: 4px;">
<f:selectItems value="#{kidController.kidAgeValue}" style="padding: 4px;"/>
</h:selectOneRadio>
<ice:commandButton id="submit" value="submit" actionListener="#{kidController.kidEntry}" style="margin-top: 10px;"/>
</ice:panelGroup>
<ice:panelGroup style="background-color: #64A8D1; padding: 9px; margin-top: 4px; font-size: 15px; border: 2px solid #03436A;">
<ice:dataTable id="kids" rowBandingInterval="1" rowSelection="multiple" rows="15" value="#{kidController.kids}" var="kid"
style="padding: 9px;">
<ice:column headerText="First Name">
<ice:outputText value="#{kid.kidFirstName}"/>
</ice:column>
<ice:column headerText="Last Name">
<ice:outputText value="#{kid.kidLastName}"/>
</ice:column>
<ice:column headerText="Email">
<ice:outputText value="#{kid.kidEmail}"/>
</ice:column>
<ice:column headerText="Age">
<ice:outputText value="#{kid.kidAge}"/>
</ice:column>
</ice:dataTable>
</ice:panelGroup>
</h:form>
</f:view>
</h:body>
</ui:composition>
I have a f:validateRegex tag that I can't seem to get working. Below I will post: you will see a validator message that I have commented out, it is part of the process, I have tried with and without the message. I'm wondering if anyone can see something wrong with the way I have written it. I can see in the server log that the validation is taking place but I get no posted message on the page; with or without the validator message. In other words the default message is not posting either. Without the proper email format the form will not submit so I know that it is working, just not producing my desired message. It works perfectly with a correctly formatted email.
any suggestions would be great! thank you.
<?xml version="1.0" encoding="UTF-8"?>
<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ice="http://www.icesoft.com/icefaces/component"
xmlns:icecore="http://www.icefaces.org/icefaces/core"
xmlns:liferay-ui="http://portletfaces.org/liferayfaces/liferay-ui"
xmlns:liferay-util="http://portletfaces.org/liferayfaces/liferay-util"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:aui="http://portletfaces.org/alloyfaces/aui"
>
<h:body>
<f:view>
<ice:panelGroup style="background-color: #64A8D1; color: #FFFFFF; padding: 9px; border: 2px solid #03436A; margin-bottom: 4px;">
<h2>Join TagMyVideo! ***</h2>
</ice:panelGroup>
<ice:outputStyle href="/css/rime-portlet.css"/>
<h:form>
<ice:panelGroup style=" color: #FFFFFF; padding: 9px; font-size: 15px; border: 2px solid #03436A;">
<ice:outputText value="First Name" style="margin-right: 4px;"/>
<ice:inputText id="fistName" required="true" value="#{kidController.kidFirstName}" style="margin-bottom: 4px;"/>
<br/>
<ice:outputText value="Last Name" style="margin-right: 5px;"/>
<ice:inputText id="lastName" required="true" value="#{kidController.kidLastName}" style="margin-bottom: 4px;"/>
<br/>
<ice:outputText value="Email" style="margin-right: 40px;" />
<ice:inputText id="email" required="true" value="#{kidController.kidEmail}" style="padding: 4px;
margin-bottom: 4px;">
<!-- validatorMessage="#{kidController.kidEmail} is not a valid email address pleas try again!">-->
<f:validateRegex pattern="^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,6})$" />
</ice:inputText>
<br/>
<h:outputLabel value="Age:" style="margin-bottom: 4px; padding: 4px;"/>
<h:selectOneRadio layout="pageDirection" value="#{kidController.kidAge}" style="padding: 4px;">
<f:selectItems value="#{kidController.kidAgeValue}" style="padding: 4px;"/>
</h:selectOneRadio>
<ice:commandButton id="submit" value="submit" actionListener="#{kidController.kidEntry}" style="margin-top: 10px;"/>
</ice:panelGroup>
<ice:panelGroup style="background-color: #64A8D1; padding: 9px; margin-top: 4px; font-size: 15px; border: 2px solid #03436A;">
<ice:dataTable id="kids" rowBandingInterval="1" rowSelection="multiple" rows="15" value="#{kidController.kids}" var="kid"
style="padding: 9px;">
<ice:column headerText="First Name">
<ice:outputText value="#{kid.kidFirstName}"/>
</ice:column>
<ice:column headerText="Last Name">
<ice:outputText value="#{kid.kidLastName}"/>
</ice:column>
<ice:column headerText="Email">
<ice:outputText value="#{kid.kidEmail}"/>
</ice:column>
<ice:column headerText="Age">
<ice:outputText value="#{kid.kidAge}"/>
</ice:column>
</ice:dataTable>
</ice:panelGroup>
</h:form>
</f:view>
</h:body>
</ui:composition>
Neil Griffin, modifié il y a 11 années.
moved to English sub-category of Liferay Faces
Liferay Legend Publications: 2655 Date d'inscription: 27/07/05 Publications récentes
moved to English sub-category of Liferay Faces
Neil Griffin, modifié il y a 11 années.
RE: moved to English sub-category of Liferay Faces
Liferay Legend Publications: 2655 Date d'inscription: 27/07/05 Publications récentes
I would recommend that you add <ice:messages /> just after the opening <h:form> element.
Rico D'Amore, modifié il y a 11 années.
RE: moved to English sub-category of Liferay Faces
New Member Publications: 13 Date d'inscription: 29/03/12 Publications récentesNeil Griffin:
I would recommend that you add <ice:messages /> just after the opening <h:form> element.
Thanks Neil, I can't believe I missed that! Well, actually I believe it.
Neil Griffin, modifié il y a 11 années.
RE: moved to English sub-category of Liferay Faces
Liferay Legend Publications: 2655 Date d'inscription: 27/07/05 Publications récentes
It happens to all of us Rico! Sometimes it just takes a second pair of eyes.
Glad it's working now.
Glad it's working now.