Jump to content
Larry Ullman's Book Forums

Recommended Posts

I ran into this issue while doing the exercises in CH 9 trying to create the login page.

 

Fatal error: Fatal error: Call to undefined method HTML_QuickForm2::Submitted() in C:\xampp2\php\pear\HTML\QuickForm2\Container.php on line 489

 

I got the above results with my login.php file and the login file from the book.

 

This is the function that is referenced by the error message.

 

/**
    * Appends an element to the container, creating it first
    *
    * The element will be created via {@link HTML_QuickForm2_Factory::createElement()}
    * and then added via the {@link appendChild()} method.
    * The element type is deduced from the method name.
    * This is a convenience method to reduce typing.
    *
    * @param string $m Method name
    * @param array  $a Method arguments
    *
    * @return   HTML_QuickForm2_Node     Added element
    * @throws   HTML_QuickForm2_InvalidArgumentException
    * @throws   HTML_QuickForm2_NotFoundException
    */
    public function __call($m, $a)
    {
        if (preg_match('/^(add)([a-zA-Z0-9_]+)$/', $m, $match)) {
            if ($match[1] == 'add') {
                $type = strtolower($match[2]);
                $name = isset($a[0]) ? $a[0] : null;
                $attr = isset($a[1]) ? $a[1] : null;
                $data = isset($a[2]) ? $a[2] : array();
                return $this->addElement($type, $name, $attr, $data);
            }
        }
        trigger_error("Fatal error: Call to undefined method ".get_class($this)."::".$m."()", E_USER_ERROR);
    }

 

Any suggestions ?

Thanks

Bruce

Link to comment
Share on other sites

I blew everything up and started over.  Saved my files and forgot about my databases; I'm glad this is just "practice".  Installed html_quicKform2 version 2.0.0 and tried again.  I got the same results.  I then used all of your files from the book and it worked!!  Somewhere in one of my files I have an issue. 

I laughed when I read at the end of one of your chapters about creating an error to see what happens....not a problem!

Off to find the needle in the haystack.

Thanks for yhour help.

Bruce

Link to comment
Share on other sites

Hey Bruce! Sorry I hadn't gotten back to you, but I'm glad to hear that you got it working. Computers can be such a pain! And sometimes things happen for no apparent reason, and then stop for no reason either. In any case, glad it's working now. 

Link to comment
Share on other sites

For the record,  The error I had was in the login.html file.  I had - if($form->submitted...; instead of if($form->isSubmitted...

 

I will say that I learned quite a bit about pear because of this and I also learned that mulitple files causes multiple headaches when trying to figure out where your errors are.

 

I did find what I think is an error in the book.  In the users.php file, the function canEditPage(Page $p); should be canEditPage(Page $page).  When I made that change the edit function worked properly.  Not saying that I didn't have another error in some other file :)

 

Have a great day.

Bruce.

Link to comment
Share on other sites

 Share

×
×
  • Create New...