Mercurial > pub > Impl
comparison Lib/IMPL/Web/TT/Form.pm @ 127:0dce0470a3d8
In the IMPL::Web::ControllerUnit added the ability to notify a form about a wrong data from a transaction
added a relativeUrl function for a usage from a templates
IMPL::Web::TT::Form now fully functional
author | wizard |
---|---|
date | Fri, 11 Jun 2010 20:21:07 +0400 |
parents | c8dfbbdd8005 |
children | c5bc900eefd3 |
comparison
equal
deleted
inserted
replaced
126:c8dfbbdd8005 | 127:0dce0470a3d8 |
---|---|
42 $path, | 42 $path, |
43 $this->element, | 43 $this->element, |
44 ) foreach @path; | 44 ) foreach @path; |
45 | 45 |
46 my $schema = $navi->Current; | 46 my $schema = $navi->Current; |
47 my $sourceSchema = $navi->SourceSchemaNode; | |
48 my $queryParameter = join '/', @path; | |
49 shift @path; | |
47 my $node = $this->data->selectSingleNode(@path); | 50 my $node = $this->data->selectSingleNode(@path); |
48 | 51 |
49 my @errors; | 52 my @errors; |
50 | 53 |
51 if ($node) { | 54 if ($node) { |
52 @errors = grep { ( $_->Node || $_->Parent) == $node } @{$this->errors}; | 55 @errors = grep { ( $_->Node || $_->Parent) == $node } @{$this->errors}; |
53 } | 56 } |
54 | 57 |
55 return { | 58 return { |
56 schema => $schema, | 59 schema => $schema, |
57 sourceSchema => $navi->SourceSchemaNode, | 60 sourceSchema => $sourceSchema, |
58 errors => \@errors, | 61 errors => \@errors, |
59 data => $node, | 62 data => $node, |
60 formParameter => join '/', @path | 63 nodeValue => $node && $node->nodeValue, # small hack set a non dom class property through |
64 queryParameter => $queryParameter | |
61 }; | 65 }; |
62 } | 66 } |
63 | 67 |
64 sub formErrors { | 68 sub formErrors { |
65 my ($this) = @_; | 69 my ($this) = @_; |
66 | 70 |
67 if (my $node = $this->data->selectSingleNode($this->base) ) { | 71 if (my $node = $this->data ) { |
68 return [ | 72 return [ |
69 grep { | 73 grep { |
70 ( $_->Node || $_->Parent) == $node | 74 ( $_->Node || $_->Parent) == $node |
71 } @{$this->errors} | 75 } @{$this->errors} |
72 ]; | 76 ]; |