Moritz Onken schrieb:
Am 06.08.2009 um 08:42 schrieb Mario Minati:
michele.gherl...@liceoberchet.it schrieb:
michele.gherl...@liceoberchet.it schrieb:
Hi Michele,
currently I don't think this is possible in the dynamic way you want
it.
What I don't understand is that materia is a underneath voti. If
materia
shall control the elements of voti, it should be at least on the
same
hierarchical level.
Hi, Mario. I didn't explain my relationships in detail, maybe.
Since table materia has_many voti, and table studente has_many
voti, in
the 'voti' table we have studente_id and materia_id. In the config
file
I
showed you, I am exploiting in the last Block underneath voti the
belongs_to relationship (voto belongs_to materia, materia_id). The
column
I'd like to restrict my results with would also be materia_id.
I think I could also try to use a multi like a select or a
checkboxgroup
with options_from_ model, but again I should then set:
model_config:
resultset: Voto
condition:
materia_id: 2
studente_id: 2315
I would propose something like this:
$element->model_config->{condition} = sub { my ($form, $element) = @_;
return { materia_id => 2, studente_id => 1234 } }
This would allow you to set the materia_id or studente_id dynamically
by iterating through the $form/$element tree.
moritz
What I understood is, that materia_id and studente_id are dependend on
the values of fields on level up in the element tree (so the value from
outside the repeatable which is also a repeatable).
So it's rather dynamic.
This is probably an other repeated inside repeated problem, as we always
pick all elements from a related table and don't use something like
search_related. But I might be wrong. The Model::DBIC class is hard to
understand.
Greets,
Mario
_______________________________________________
HTML-FormFu mailing list
HTML-FormFu@lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu