View Single Post
  #2  
Old 09-27-2014, 03:18 PM
IntoRain's Avatar
IntoRain IntoRain is offline
Moderator
 
Join Date: Jul 2013
Location: Portugal
Posts: 461
Gender: Female
Credits: 22,274
IntoRain is on a distinguished road
Default

Quote:
Originally Posted by FounderSim View Post
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)
__________________


asp.net stole my soul.

Last edited by IntoRain; 09-27-2014 at 03:31 PM.
Reply With Quote