Just hitting my head to a wall with this:
I have defined a field like this:
$field = $modules->get("InputfieldRadios");
$field->label = "Gender";
$field->addOption('girl', 'Girl');
$field->addOption('boy', 'Boy');
$field->attr("name+id",'gender');
$form->append($field);
and try to save the field after submit with this:
$form->processInput($input->post);
$uploadpage = new Page();
$uploadpage->gender = $form->gender->value;
//OR
$uploadpage->set($form->gender->name, $form->gender->value);
But it doesn't save the field value. With Ryans FormTemplateProcessor module this template works, but trying to do the "dirty work" manually, I just can't get radiobuttons or checkboxes to save.
What is it that I don't understand here?
EDIT:
OK, Soma helped me on IRC:
Change
$field->addOption('girl','Girl');
to this:
$gender = $pages->get("/options/gender/")->children();
foreach ($gender as $p) {
$field->addOption($p->id,$p->title);
}
This is because I am using pages as options. Then save the field like this:
$uploadpage->set($form->gender->name, $form->gender->value);
Thanks to Soma!