When a ValidatorGroupSubscriber is added to a view its react correctly at first VO instanciation/binding but does not "refresh" when the targetted VO is updated. This cause the validation to fail graphically (eg. there's no more red border shown while a field is erroneous)
You can easily reproduce the bug with the insync modular example :
1- launch insync shell
2- get at least two contacts in the search grid
3- double-click on the first
4- clear the firstname field (for example of a mandatory field) -> the field is "border red" decorated
5- set somehting inside the field -> the red border disapear OK
6- double-click on another contact from the grid
7- repeat operation 4 and see how the application react : -> no red border appears, VO's validation is still enabled and working (save button not enabled) but nothing appear at view level.
Going deeper in debug mode seems to indicate "watcher/linstener" from validator is not correctly affected while you change the VO.
Please confirm the bug and tell if this could be corrected/fixed/correct with workaround
Thx for all ![]()
PS:I've already post this in the dev forum... guess it' was not the right place to put it so I apologize if this seems to be "spam-like"
I could recreate the issue, I'm updating the steps to reproduce as you also need to close the exisisting tab to notice the issue:
1- launch insync shell
2- get at least two contacts in the search grid
3- double-click on the first
4- clear the firstname field (for example of a mandatory field) -> the field is "border red" decorated
5- set somehting inside the field -> the red border disapear OK
6- close the existing contact
7- double-click on another contact from the grid
8- repeat operation 4 and see how the application react : -> no red border appears, VO's validation is still enabled and working (save button not enabled) but nothing appear at view level.
Yes indeed I saw this few times later and something strange happens : sometime it works sometime it does not...
I also tried to create a small application in order to see what could happen depending on the context VO is set :
The application is based on a search (as you have in inSync) a datagrid and ayabnavigator containing Contact you want to edit.
The tabnavigator owns "editable" forms filled/created when 2xClick on datagrid contact.
It seems to be as it is in InSync but as I've got a more complex form and business (supposed to be) each form are linked to their model which own Contact VO (filled by event like "load/save") .
It means VO is not in the view but in the model linked to the view (by injection) and here is the mess comming
:
1- select a contact -> form is added to tabnavigator and loadContact command is performed then data are set on model's view (my form) with resulting loaded ContactVO
2- clear a field which is mandatory -> red border
3- fill it again -> no more red border
4- cancel the edition -> cause the load command to perform again so as in 1) the ContactVO is set with the result VO retrieved from DB.
5- do 2 and 3 again -> red border no more appears.
I hope this is "clear" enough but to summary it seems that if you're simply affect a new value to a VO the view validatorSubsriber was linked with this put the mess.
regards
Cédric
Hi Cédric,
Sorry it took so long to get back to you, I modified locally the ValidatorGroupSubscriber to fix the issue. Basically resetting the VO (and hence the validator) was correctly updating the validatorSubscriber but not re-registering the UIComponent with the new validator.
I've attached a temporary Validation.swc, let me know if that works for you.
Cheers
Thx for your reply Nicolas and don't bother you didn't take so much time ![]()
There's a small improvement in the validation library when I use it on my project :
1- With the previous validation release (1.12) I was selecting a Person A -> view was updated with Person A information (comming from a VO) based on the relative injected model (code behind style) . Then I was deleting mandatory info from a field -> validation magic opers then red border raises.
I was then selecting Person B (injected model was refering the new reference of VO - there's perhaps where troubles are comming from...) and the red border was still there. I change the field value (clear and fill again) -> nothing happened : red border still there. I should gone back previous selected Person A to fill again value and red border disapears. Switching again on Person B show no red border but clearing the mandatory field does not make the red border appearing anymore...
2- With the new version : Red border still there when I switch from invalid Person A to valid Person B but switching to Person A and filling the mandatory info then swtiching Person B and cleaning mandatory info makes red border appearing !
So it's better but unfortunatly not perfect.
I maybe make a mistake by setting the validation stuff based on a VO which is not IN the view but is IN the model injected in the view ???
But I'm following best practice pattern & code behind and I could not see why this should not work (it works for event/command/injection stuff but not for validation... sadly...)
So I'm sorry Nicolas. I hope I don't bother you and need some more help from you.
Cédric
PS : anyway many thanks for your previous help and it was fast enough to help me.
Still waiting for your news ![]()
Hi Cédric,
I've attached an updated library. For now you will have to call the reset method when swapping the validators as:
public function set data(value:Object):void
{
validatorGroupSubscriber.reset();
contact=value as Contact;
}
Also note that when swapping the object the validation will not be retriggered automatically (ie fields will not be highlighted in red by default). You can enable the resetValidationFeedbackOnFocusIn property on the ValidatorGroupSubscriber or I can add an extra flag if you need instant validation when swapping VOs.
Hi Nicolas,
Again : Thanks for your help.
The last Validation module is FULLY correctly working ![]()
I've first had a ùajor issue while saving the VO :
[RPC Fault faultString="Unknown AMF type '15'." faultCode="Client.Message.Encoding" faultDetail="null"]
at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::faultHandler()
at mx.rpc::Responder/fault()
at mx.rpc::AsyncRequest/fault()
at NetConnectionMessageResponder/statusHandler()
at mx.messaging::MessageResponder/status()
But it was because I stupidly forget to set the Transient attribute on the VO's validator group...
So, thanks again for your work Nicolas and thanks for the Cairngorm 3 stuff in a general way (it offers really impressive and nice way to use Flex and Best practices)
One more (and last) question : Will this version of Validation stuff be release officialy ? And when ( days or weeks or month ?)
Regards
Cédric
North America
Europe, Middle East and Africa
Asia Pacific