I'm new to symfony, so this may be trivial, but I'm getting frustrated
trying to find a solution. I'm having a problem creating a form to
edit a set of objects associated with another specified object. Here's
an abridged version of the relevant part of the schema (assume id
fields are auto-generated):

Collection:
  columns:
    name:
      type: string(255)
    description:
      type: string()

Question:
  columns:
    question_text:
      type: string(255)

QuestionOption:
  columns:
    question_id:
      type: integer
    option_text:
      type: string(255)
  relations:
    Question:
      local: question_id
      foreign: id
      type: one

QuestionResponse:
  columns:
    collection_id:
      type: integer
    context_question_id:
      type: integer
    context_question_option_id:
      type: integer
  relations:
    Question:
      local: context_question_id
      foreign: id
      type: one
      foreignAlias: Answers
    QuestionOption:
      local: context_question_option_id
      foreign: id
      type: one
      foreignAlias: Choices
    Collection:
      local: collection_id
      foreign: id
      type: one
      foreignAlias: QuestionResponses

I have a basic form to create/edit the standard Collection info (name,
description, some other fields I haven't shown here). I've added code
to actions.class.php so that when a new Collection is created, a
corresponding empty QuestionResponse (i.e. no QuestionOption
specified) is created for each Question in the database.

What I want now is a new form to edit the Question Responses for a
Collection. I've created a custom form, and the corresponding custom
actions within the Collection module and embedded the
QuestionResponseForm within it. There are two things I can't see how
to do:

a) Restrict the QuestionOptions available for each QuestionResponse
(using sfWidgetFormSelect) to those appropriate to the corresponding
Question.

b) Display the text of the corresponding Question as the label for
each field.

This sounds to me like it should be straightforward, which is making
it all the more frustrating that I can't see the solution. I'm using
Symfony 1.4, btw.

Thanks for any advice,

Paddy

-- 
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-us...@googlegroups.com.
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en.

Reply via email to