On 27.06.2004 14:46, Colin Paul Adams wrote:

So I started by writing the binding definition. I took the XML Binding
sample as a model (using just the repeater bit at the bottom of the
page).
I shall eventually want to do the date as an aggregate I guess, but
for starters I'll just do it as a text field.
My uncertainity comes with the time-clause in the grammar. This is
optional (we often don't know what time a concert will start, when we
first get a date for it). And the finishing time is optional too, but
can only be present if the time attribute is present.

So when I wrote the following, I paused for thought:

  <fb:on-insert-row>
      <!-- The insert-node element contains a piece of template XML to be
      inserted for new rows. Alternatively, you could also add a "src"
      attribute on the insert-node element pointing to an external source
      to retrieve the template from. -->
      <fb:insert-node>
        <!-- template inserted by the binding for new rows (mapping new nodes) -->
        <event id="" row-state="new" date="" time="" finish-at="" 
suppress-recurring="">
          <title/><location/>
        </event>
      </fb:insert-node>
    </fb:on-insert-row>

because I am not sure what is going to happen when the form is
submitted. According to the validation criteria, the time attribute cannot be
empty, but it can be missing. likewise finish-at attribute.
Will form submission automatically infer this from the schema, and do
the right thing? Or will I have to write some logic to handle this?


CForms plus data binding is clearly very powerful, but writing the
first form is a bit daunting.

You really do not have the simplest requirements ;-)

You can try to remove @time from fb:insert-node/event and add it to fb:on-bind with a fb:value element. Don't know if it works though.

Joerg

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to