You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Manuel Mata <ma...@yahoo.es> on 2007/02/27 17:52:06 UTC

Multiple regular expresion validation

Hi all. I have this widget definition and a surely
with easy solution problem, but i dont know how.

<fd:field id="phone" required="true">
 <fd:label><i18n:text key="label.phone"/>:</fd:label>
 <fd:datatype base="string"/>
 <fd:validation>
  <fd:length max="12"/>
  <fd:regexp pattern="[0-9](9)"/>
  <fd:regexp pattern="[0-9](3) [0-9](3) [0-9](3)"/>
  <fd:regexp pattern="[0-9](3) [0-9](2) [0-9](2)
[0-9](2)"/>
 </fd:validation>
</fd:field>

What i need is to accept phone numbers like:

XXXXXXXXX
XXX XXX XXX
XXX XX XX XX

but the form only validates the first one. How can i
do that accept anyone of the three ?.

Another question. Is it possible to define this widget
in any file like "phone.widget.xml" and reuse it in
forms with a strategy like xi:include ?

Thx for your time.


		
______________________________________________ 
LLama Gratis a cualquier PC del Mundo. 
Llamadas a fijos y móviles desde 1 céntimo por minuto. 
http://es.voice.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Multiple regular expresion validation

Posted by Grzegorz Kossakowski <gr...@tuffmail.com>.
Manuel Mata napisał(a):
> But i cant use the xi:include. It should be a nice
> feature to define widgets individually and use in
> forms referencing them.
>   
You can do this and even much more than simple inclusion, see:
http://cocoon.apache.org/2.1/userdocs/formlibraries.html

-- 
Grzegorz Kossakowski

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Multiple regular expresion validation

Posted by Manuel Mata <ma...@yahoo.es>.
Yeah it works. I should read some about RE ...

<fd:regexp pattern="\d{9}|\d{3} \d{3} \d{3}|\d{3}
\d{2} \d{2} \d{2}">

But i cant use the xi:include. It should be a nice
feature to define widgets individually and use in
forms referencing them.

See ya.

--- Gajo Csaba <cs...@enyem.com> escribió:

> Manual, can't you just change your first regular
> expression to something  
> like this?
> 
> ([0-9](9))|([0-9](3) [0-9](3) [0-9](3))|([0-9](3)
> [0-9](2) [0-9](2))
> 
> Csaba
> 
> 
> On Tue, 27 Feb 2007 17:52:06 +0100, Manuel Mata  
> <ma...@yahoo.es> wrote:
> 
> > Hi all. I have this widget definition and a surely
> > with easy solution problem, but i dont know how.
> >
> > <fd:field id="phone" required="true">
> >  <fd:label><i18n:text
> key="label.phone"/>:</fd:label>
> >  <fd:datatype base="string"/>
> >  <fd:validation>
> >   <fd:length max="12"/>
> >   <fd:regexp pattern="[0-9](9)"/>
> >   <fd:regexp pattern="[0-9](3) [0-9](3)
> [0-9](3)"/>
> >   <fd:regexp pattern="[0-9](3) [0-9](2) [0-9](2)
> > [0-9](2)"/>
> >  </fd:validation>
> > </fd:field>
> >
> > What i need is to accept phone numbers like:
> >
> > XXXXXXXXX
> > XXX XXX XXX
> > XXX XX XX XX
> >
> > but the form only validates the first one. How can
> i
> > do that accept anyone of the three ?.
> >
> > Another question. Is it possible to define this
> widget
> > in any file like "phone.widget.xml" and reuse it
> in
> > forms with a strategy like xi:include ?
> >
> > Thx for your time.
> >
> >
> > 		
> > ______________________________________________
> > LLama Gratis a cualquier PC del Mundo.
> > Llamadas a fijos y móviles desde 1 céntimo por
> minuto.
> > http://es.voice.yahoo.com
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail:
> users-help@cocoon.apache.org
> >
> >
> >
> 
> 
> 
> -- 
> Using Opera's revolutionary e-mail client:
> http://www.opera.com/mail/
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail:
> users-help@cocoon.apache.org
> 
> 



		
______________________________________________ 
LLama Gratis a cualquier PC del Mundo. 
Llamadas a fijos y móviles desde 1 céntimo por minuto. 
http://es.voice.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Multiple regular expresion validation

Posted by Gajo Csaba <cs...@enyem.com>.
Manual, can't you just change your first regular expression to something  
like this?

([0-9](9))|([0-9](3) [0-9](3) [0-9](3))|([0-9](3) [0-9](2) [0-9](2))

Csaba


On Tue, 27 Feb 2007 17:52:06 +0100, Manuel Mata  
<ma...@yahoo.es> wrote:

> Hi all. I have this widget definition and a surely
> with easy solution problem, but i dont know how.
>
> <fd:field id="phone" required="true">
>  <fd:label><i18n:text key="label.phone"/>:</fd:label>
>  <fd:datatype base="string"/>
>  <fd:validation>
>   <fd:length max="12"/>
>   <fd:regexp pattern="[0-9](9)"/>
>   <fd:regexp pattern="[0-9](3) [0-9](3) [0-9](3)"/>
>   <fd:regexp pattern="[0-9](3) [0-9](2) [0-9](2)
> [0-9](2)"/>
>  </fd:validation>
> </fd:field>
>
> What i need is to accept phone numbers like:
>
> XXXXXXXXX
> XXX XXX XXX
> XXX XX XX XX
>
> but the form only validates the first one. How can i
> do that accept anyone of the three ?.
>
> Another question. Is it possible to define this widget
> in any file like "phone.widget.xml" and reuse it in
> forms with a strategy like xi:include ?
>
> Thx for your time.
>
>
> 		
> ______________________________________________
> LLama Gratis a cualquier PC del Mundo.
> Llamadas a fijos y móviles desde 1 céntimo por minuto.
> http://es.voice.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>



-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org