RE: [flexcoders] Validator + ValueObject

2005-01-29 Thread Allen Manning



James,

Please see the below code snippets, this works for 
us...

HTH,
Allen

vo:PaymentVO id="editedPayment" 
label="{labelTextInput.text}"

mx:StringValidator field="editedPayment.label"/
import mx.validators.Validator;
public function addHandler( event ):Void
{
if (!Validator.isStructureValid(this, 'editedPayment'))
return;
}






From: Matt Chotin 
[mailto:[EMAIL PROTECTED] Sent: 28 January 2005 
23:58To: flexcoders@yahoogroups.comSubject: RE: 
[flexcoders] Validator + ValueObject


Its because youre 
probably not using binding to setup the relationship between the contactVO and 
the form fields. All you need to do is on your validators set the listener 
property to be the TextInput that is the source.

Matt





From: James 
Ward [mailto:[EMAIL PROTECTED] Sent: Friday, January 28, 2005 2:42 
PMTo: flexcoders@yahoogroups.comSubject: [flexcoders] Validator + 
ValueObject

Has anyone ever tried to use the Validator with a 
ValueObject instead ofa Model object? I am trying it, but instead of my form 
fields gettingred borders when 
validation fails, I get pop-ups. :(Here is some of my code:import valueobjects.*;var contactVO : ContactVO;function initApp() : Void{ 
contactVO = new ContactVO();}function 
nextPage() : Void{ 
loadContactVO(); if 
(mx.validators.Validator.isStructureValid(this,'contactVO')) { // flip to the second 
accordian 
information.selectedIndex = 1; }}mx:Validator 
field="contactVO.name"/mx:EmailValidator 
field="contactVO.email"/mx:PhoneNumberValidator 
field="contactVO.phone"/If I add in a Model object then it will work, but I hate 
having tomaintain my value objects 
in 3 places.BTW: The reason why 
I am using a Value Object is because it seems that Ihave to in order to pass a VO to my 
RemoteObject.Thanks in 
advance.-James


RE: [flexcoders] Validator + ValueObject

2005-01-28 Thread Matt Chotin








Its because youre probably not
using binding to setup the relationship between the contactVO and the form
fields. All you need to do is on your validators set the listener property to
be the TextInput that is the source.



Matt











From: James Ward
[mailto:[EMAIL PROTECTED] 
Sent: Friday, January 28, 2005
2:42 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Validator +
ValueObject





Has anyone ever tried to use the Validator with a ValueObject instead
of
a Model object? I am trying it, but instead
of my form fields getting
red borders when validation fails, I get
pop-ups. :(

Here is some of my code:

import valueobjects.*;

var contactVO : ContactVO;

function initApp() : Void
{
 contactVO = new ContactVO();
}

function nextPage() : Void
{
 loadContactVO();

 if
(mx.validators.Validator.isStructureValid(this,'contactVO'))
 {
 // flip to the second accordian
 information.selectedIndex= 1;
 }
}


mx:Validator
field=contactVO.name/
mx:EmailValidator
field=contactVO.email/
mx:PhoneNumberValidator
field=contactVO.phone/


If I add in a Model object then it will work, but
I hate having to
maintain my value objects in 3 places.

BTW: The reason why I am using a Value Object is
because it seems that I
have to in order to pass a VO to my RemoteObject.

Thanks in advance.

-James