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
This way is not dynamic and even the condition options is only available for options_from_model method.

Could I set these 2 params using dynamically defined values?
No, thats the problem. Currently Model::DBIC picks just 'all' elements from the resultset (line 308). To implement some kind of selection at this point we need to implement the condition attribute. Which way would you say should a declaration for dynamic attributes look like?


Greets,

Mario Minati

To achieve your goal, we would need to extend FormFu::Model::DBI to
handle dynamic parameters.


Greets,

Mario Minati

michele.gherl...@liceoberchet.it schrieb:
Hi all.
I've setup the following relationships in my application:
- table classe has_many studenti
- table studente has_many voti
- table voto belongs_to studente, materia
Now I have created the following table/form in yaml:

---
auto_fieldset: 1
elements:
  - type: Hidden
    name: count
  - type: Block
    tag: table
    attributes:
      width: 100%
    elements:
        - type: Repeatable
          tag: tr
          nested_name: studenti
          counter_name: count
          elements:
            - type: Block
              tag: td
              elements:
                - type: Hidden
                  name: id
                - type: Label
                  name: cognome
                - type: Label
                  name: nome
                - type: Hidden
                  name: count
                - type: Repeatable
                  nested_name: voti
                  counter_name: count
                  tag: td
                  elements:
                    - type: Hidden
                      name: id
                    - name: voto
                    - name: data_voto
                    - type: Block
                      nested_name: materia
                      elements:
                        - name: materia

  - type: Submit
    name: submit
    attributes:
      value: Invia

This works very well. But what I want now to do is to restrict the rows
which are retrieved by the nested Repeatable 'voti' based on the value
of
'materia', i.e. I *DON'T* want all the notes for each student, but I
want
only a few of them based upon some search criteria. How can I pass a
search condition or something similar to the repeatable block? Is this
possible at all?
Thanks in advance,
Michele Gherlone



_______________________________________________
HTML-FormFu mailing list
HTML-FormFu@lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu

_______________________________________________
HTML-FormFu mailing list
HTML-FormFu@lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu




_______________________________________________
HTML-FormFu mailing list
HTML-FormFu@lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu


_______________________________________________
HTML-FormFu mailing list
HTML-FormFu@lists.scsys.co.uk
http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/html-formfu

Reply via email to