Quote:
Originally Posted by FounderSim
Thanks for the reply IntoRain.
I seen I could do it that way. I am trying to use the methods already provided in the class "class_formhelper.php".
This way I don't have to like "recode" whats already there if you can understand. It also seems more reasonable to add new methods to the class_formhelper.php when creating new drop down list with database information then the aproach you mentioned as well.
I just don't know how to properly use them. =(
|
I see. I think the ->build(...) way is more suited to that example you posted. If you want to use this way with the code you already have, we can be a bit hacky about it:
buildAdoptTypeList is a function of the class FormHelper, so you can't do new buildAdoptTypeList(). You need an instance of FormHelper first, then call its functions:
PHP Code:
$exampleHelper = new FormHelper();
$exampleDropdown = $exampleHelper->buildAdoptTypeList("myList");//new DropdownList("myList");
//edit: you can do this now:
$petField->add($exampleDropdown);
And you can add that dropdown $exampleDropdown to the form (or the fieldset you have there)