Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Am just branching out into PEAR and OO in general and having a bit of a problem with QuickForm which I am sure is because I am an idiot.
Am trying to have a check box which is set according to a value in a db. If the isLive field is set I want the box to be checked. If it isn't I want the box to be unchecked.
This is the codeCode: Select all
// instantiate a new form
$form = &new HTML_QuickForm('edit', 'post');
// build the form
$form->addElement('date', 'date', 'Crossword date', $options);
$form->addElement('text', 'solutionAcross', 'Solution across', array("size" => 40, "value" => "{$row['solutionAcross']}"));
$form->addElement('text', 'solutionDown', 'Solution down', array("size" => 40, "value" => "{$row['solutionDown']}"));
$form->addElement('text', 'clueAcross', 'Clue across', array("size" => 40, "value" => "{$row['clueAcross']}"));
$form->addElement('text', 'clueDown', 'Clue down', array("size" => 40, "value" => "{$row['clueDown']}"));
$form->addElement('text', 'hint', 'hint', array("size" => 40, "value" => "{$row['hint']}"));
$form->addElement('advcheckbox', 'isLive', 'Queued to go live', NULL, NULL, array(1,0));
$checked=FALSE;
if ($row['isLive']) $checked = TRUE;
$form->setChecked($checked);
$form->addElement('submit', 'btnSubmit', 'Submit');
$form->addElement('hidden', 'crosswordID', $crosswordID);$row is an array containing variables sucked out of a db
except it errors out with
Fatal error: Call to undefined function: setchecked()
The rest of the form is just fine.
Clearly I am cocking it up - would just be v grateful if someone could point me in the right direction. I have tried to find any help I can, but the manual on PEAR isn't quite as helpful (or rather pre-supposes more knowledge) than the PHP manual does.
Many thanks in advance.
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]