When passing an empty array into the ezform add, none of the form elements
are printed. Example code might be:
...
$teams = array();
$result = $GLOBALS["core"]->sqlSelect("mod_leaguesite_teams", NULL, NULL, "teamcity,teamname");
if($result)
foreach ($result as $row)
$teams[$row["id"]] = $row["teamcity"] . " " . $row["teamname"];
$form = new EZform("mystuff_edit");
$form->add("team_id", "select", $teams);
...
If there are no teams in the mod_leaguesite_teams table, $result will be
null. If that is the case then the $teams array will be empty, and when
that happens none of the form elements for $form are printed at all. all
the other text boxes and whatever kind of fields are just not printed. I
can understand maybe not printing the select box, but rest of the form
elements should at least still be printed.
I got around it by adding a blank option which I wanted anyway right after
the array creation:
$teams = array();
$teams[] = NULL;
So now I get at least an empty select box. Probably not the most
beautiful but oh well.
|