Validando data com o <mx:DateValidator />

36 views
Skip to first unread message

João Guimarães Filho

unread,
May 12, 2011, 2:33:08 PM5/12/11
to FlexPB
O que tem de errado nesse codigo?

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955"
minHeight="600">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here
-->
</fx:Declarations>

<s:Panel x="150" y="58" width="463" height="358">
<s:Label x="43" y="80" text="Data de Nascimento:"/>
<s:TextInput id="data_nasc" x="170" y="70"/>
<s:Label x="306" y="80" text="Ex.: 01/01/2001"/>
<s:Label x="43" y="114" text="Data de Cadastro:"/>
<s:TextInput x="170" y="104"/>
<s:Label x="306" y="114" text="Ex.: 01/01/2001"/>
<s:Button x="203" y="137" label="ok"/>
</s:Panel>
<mx:DateValidator source="data_nasc" property="text" inputFormat="dd/
mm/yyyy" allowedFormatChars="/" />

</s:Application>

Mensagem de Erro: Description Resource Path Location Type
'DateValidator' declaration must be contained within the
<Declarations> tag, since it is not assignable to the default
property's element type 'mx.core.IVisualElement'. main.mxml /
ValidandoDatas/src line 18 Flex Problem

Genison Junior

unread,
May 12, 2011, 2:45:21 PM5/12/11
to fle...@googlegroups.com
O DateValidator precisa ficar dentro da tag <fx:Declarations>


--
Esta mensagem foi recebida porque você está inscrito no grupo "FlexPB".
Para postar nesse grupo, envie email para fle...@googlegroups.com
Para cancelar sua assinatura envie email para flexpb+un...@googlegroups.com
Para mais opções, visite o grupo em: http://groups.google.com/group/flexpb?hl=pt-BR



--
Genison Junior
Desenvolvedor Flex / PHP
Graduando em Sistemas para Internet @ Fatec PB
Email/Gtalk/Msn: gen...@gmail.com
Twitter: http://www.twitter.com/genison
+ 55 83 9108-0608

Wagner Souza Silva

unread,
May 12, 2011, 2:46:47 PM5/12/11
to fle...@googlegroups.com

Boa tarde!
Você tem que colocar o mx:datevalidator dentro da tag fx:declarations.

João Guimarães Filho

unread,
May 12, 2011, 2:54:31 PM5/12/11
to FlexPB
É pessoal, coisa de quem tá começando e falta de atenção. Obrigado!

Essas mudanças entre Spark e Halo me atrapalham.

On May 12, 3:46 pm, Wagner Souza Silva <wja...@gmail.com> wrote:
> Boa tarde!
> Você tem que colocar o mx:datevalidator dentro da tag fx:declarations.
>
> Em 12/05/2011 15:33, "João Guimarães Filho" <guimaraesfi...@gmail.com

João Guimarães Filho

unread,
May 12, 2011, 3:15:42 PM5/12/11
to FlexPB
Pessoal, coloquei o <mx:DateValidator /> Dentro da declaração
<fx:Declarations> porem o projeto não aparece no browser.

To executando no Chrome e não mostra nenhum erro.

---------------------------------------------

<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here
-->
<mx:DateValidator source="data_nasc" property="text" inputFormat="dd/
mm/yyyy"
allowedFormatChars="/" wrongDayError="Entre com um dia valido
para esse mês"
wrongMonthError="Digite um mês valido entre 1 e 12"
requiredFieldError="Campo obrigatorio" />
<mx:DateValidator source="data_cad" property="text" inputFormat="dd/
mm/yyyy"
allowedFormatChars="/" wrongDayError="Entre com um dia valido
para esse mês"
wrongMonthError="Digite um mês valido entre 1 e 12"
requiredFieldError="Campo obrigatorio" />
</fx:Declarations>

<s:Panel x="150" y="58" width="463" height="358">
<s:Label x="43" y="80" text="Data de Nascimento:"/>
<s:TextInput id="data_nasc" x="170" y="70"/>
<s:Label x="306" y="80" text="Ex.: 01/01/2001"/>
<s:Label x="43" y="114" text="Data de Cadastro:"/>
<s:TextInput id="data_cad" x="170" y="104"/>
Reply all
Reply to author
Forward
0 new messages