30/06/2011 4:43pm

PHP | Solution -


// Quick and Dirty way to add multiple fieldsets to (frontend) forms


<?php

// mysite/code/FieldsetStartField.php
class FieldsetStartField extends ReadonlyField
{
}

// mysite/code/FieldsetEndField.php
class FieldsetEndField extends ReadonlyField
{
}

// A form example

$myForm = new Form(
$this,
"OrderForm",
$mainFieldset = new FieldSet(
// Fieldset 1
new FieldsetStartField('Fieldset1', 'Contactgegevens besteller'),
new TextField('Name', 'Uw naam*'),
new FieldsetEndField('Fieldset1_end', 'Fieldset1_end'),
// Fieldset 2
new FieldsetStartField('Fieldset2', 'Bestelling'),
$myTableField = new TableField('Producten', 'Product', $productFieldTitles, $productFields),
new FieldsetEndField('Fieldset2_end', 'Fieldset2_end')
),
new FieldSet(
new FormAction("doOrderForm", 'Verzenden')
), $validator
);

return $myForm;
}


Post Comment