I need to be able to do some pre- and post- processing of values
that will be contained in repeater rows in a CForm.
The form defn will look something like:
<fd:widgets>
<fd:field id="title" required="true">
<fd:label>Title</fd:label>
<fd:datatype base="string"/>
</fd:field>
<fd:repeater id="terrains">
<fd:widgets>
<fd:output id="id">
<fd:datatype base="integer"/>
</fd:output>
<fd:field id="terr_name">
<fd:datatype base="string"/>
<fd:label>Name</fd:label>
</fd:field>
<fd:field id="terr_size">
<fd:datatype base="integer"/>
<fd:label>Name</fd:label>
</fd:field>
<fd:booleanfield id="select">
<fd:label>Select</fd:label>
</fd:booleanfield>
</fd:widgets>
</fd:repeater>
<fd:repeater-action id="addterrain" action-command="add-row"
repeater="terrains">
<fd:label>Add terrain</fd:label>
</fd:repeater-action>
<fd:repeater-action id="removeterrain" action-command="delete-rows"
repeater="terrains" select="select">
<fd:label>Remove selected terrain</fd:label>
</fd:repeater-action>
</fd:widgets>
The form will be created as usual:
var editDataForm = new Form("view/forms/editForm_d.xml");
var model = editDataForm.getModel();
1. PRE-PROCESSING
I then need to assign data to the various elements.
For the single value field it is simple:
//assign data to the form/model
model.title = "Dummy";
But - how to create the repeater rows and assign a set of values
to them?
2. POST-PROCESSING
When post-processing, I again need to process the repeater
rows - bearing in mind the user could have added or deleted
some/all of the rows...
The value from the single value field is contained in the
model.title
variable; but, again - how to know how many repeater values
exist, and what their values are?
I am sure this is not complex, but I have not been able to find
any examples on the Cocoon site or in past messages.
Thanks
Derek
--
This message is subject to the CSIR's copyright, terms and conditions and
e-mail legal notice. Views expressed herein do not necessarily represent the
views of the CSIR.
CSIR E-mail Legal Notice
http://mail.csir.co.za/CSIR_eMail_Legal_Notice.html
CSIR Copyright, Terms and Conditions
http://mail.csir.co.za/CSIR_Copyright.html
For electronic copies of the CSIR Copyright, Terms and Conditions and the CSIR
Legal Notice send a blank message with REQUEST LEGAL in the subject line to
[EMAIL PROTECTED]
This message has been scanned for viruses and dangerous content by MailScanner,
and is believed to be clean. MailScanner thanks Transtec Computers for their
support.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]