Good Night,

I'm trying to make this code work but they are 3 problems with it.

Here are the 3 errors:

Method HtmlHelper::FormHelper does not exist

Method HtmlHelper::hiddenTag does not exist

Method HtmlHelper::radio does not exist


Heres's the file general.ctp that I'm using:

I tryied to find a solution searching on the Net, but I couldn't find
a way to fix it.

Regards,



<div class="tiny_title">Well, the poll</div>

<div id="loading" style="display: none;">
       <?php echo $html->image("static/loading.gif", array
("alt"=>"Loading")); ?>
</div>

<div id="add_pollrow">
  <?php

    if ( !isset( $_SESSION["poll"] )  ) // the user has not voted, so,
set the form
   {
     echo $html->FormHelper('#','post', array("onsubmit"=>"return
false;"));    // do nothing

     $array   = array();

     echo "<p><b>" . $poll[0]['Poll']['question'] ."</b></p>";

     echo $html->hiddenTag('Pollrow/poll_id', $poll[0]['Poll']
['id']);       // Poll_id

     foreach ($poll[0]['Pollrow'] as $key=>$val)
     {
          $array[$val['id']] = $val
['answer'];                                      // construct id-
>value array
     }

    echo $html->radio('Pollrow/id', $array, '<br /><br /
>');              //print the answers

    echo '<br /><br />';

    echo $ajax->submit('Vote', array("url" => "/pollrows/vote",
                                     "update"=>"add_pollrow",       //
add_pollrow wil be updated with app/views/pollrows/results.thtml
render
                                     "loading" => "Element.hide
('add_pollrow');Element.show('loading')",
                                     "complete" => "Element.hide
('loading');Effect.Appear('add_pollrow')"
        ));
  echo '</form>';
  }
  else // the user has voted, so just print the poll results
  {

    $total_votes = 0;

    foreach ($poll[0]["Pollrow"] as $key => $val)
    {
        $total_votes += $val["vote"];  // the total votes
    }

    foreach ($poll[0]["Pollrow"] as $key => $val)
    {
             $percent = ($val["vote"] * 100) / $total_votes;  // % =
votes * 100 / total
             $width   = number_format($percent, 0);
             echo '<p><b>'.$val['answer'].'</b> '.number_format
($percent, 2).'% <br />';
             echo $html->image('static/poll/'.$val["color"].'.png',
array("height"=>"10", "width"=>$width,"alt"=>$val["answer"], "title"=>
$val["answer"]) );
             echo "  ". $val['vote'];
    }

  echo "<p class='negrita'>Total votes:" . $total_votes . "</p>";
}
?>
</div>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to