PEAR Forum :: PHP Extension and Application Repository

PEAR Forum Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
HTML_QuickForm2::createElement() doesn't exist?

 
Post new topic   Reply to topic    PEAR Forum Forum Index -> HTML
View previous topic :: View next topic  
Author Message
Jb boin



Joined: 20 May 2008
Posts: 6
Location: Grenoble, France

PostPosted: Tue May 20, 2008 4:18 pm    Post subject: HTML_QuickForm2::createElement() doesn't exist? Reply with quote

I want to put 2 buttons in one line with HTML_QuickForm2 and i have only found this solution on the net (i changed myself QuickForm to QuickForm2 :
Code:
$buttons[] = &HTML_QuickForm2::createElement('submit', 'btnSubmit', 'Submit');
$form->addGroup($buttons, '', '', '&nbsp;');   echo '<form' . $form->getAttributes(true) . ">\n";


And this give me this error :
Code:
Fatal error: Call to undefined method HTML_QuickForm2::createElement()


So is there another way to place 2 buttons on the same line with QuickForm2 or i need to use Quickform?

Thanks by advance.
Back to top
View user's profile Send private message
Jb boin



Joined: 20 May 2008
Posts: 6
Location: Grenoble, France

PostPosted: Fri May 30, 2008 10:17 am    Post subject: Reply with quote

For the ones who can encounter same kind of problem, i had to modify the page layout in the output_element function, its unelegant but it works if you want to have buttons (or other items) on the same line :

Code:
function output_element($element)
{
    if ('fieldset' == $element->getType()) {
        output_fieldset($element);
    } elseif ('hidden' == $element->getType()) {
        echo '<div style="display: none;">' . $element->__toString() . "</div>\n";

    } elseif ( 'reset' == $element->getType() or 'submit' == $element->getType() or 'button' == $element->getType() or 'radio' == $element->getType()  or 'bday' == $element->getname() or 'byear' == $element->getname() ) {
        $required = $element->isRequired();
        $error    = $element->getError();
        echo '<div class="qfrow"><label class="alignlabel"> <div class="qfelement' . (strlen($error)? ' error': '') . '">' .
             (strlen($error)? '<span class="error">' . $error . '</span>': '') .
             $element->__toString() . "</label></div></div>\n";

    } elseif ( 'bmonth' == $element->getname() ) {
        $required = $element->isRequired();
        $error    = $element->getError();
        echo '<div class="qfrow"><label class="qflabel" for="' . $element->getId() .
             '">' . ($required? '<span class="required">*</span>': '') . $element->getLabel() .
             '</label> <div class="qfelement' . (strlen($error)? ' error': '') . '">' .
             (strlen($error)? '<span class="error">' . $error . '</span><br />': '') .
             $element->__toString() . "</div></div>\n";

    } else {
        $required = $element->isRequired();
        $error    = $element->getError();
        echo '<div class="qfrow"><label class="qflabel" for="' . $element->getId() .
             '">' . ($required? '<span class="required">*</span>': '') . $element->getLabel() .
             '</label> <div class="qfelement' . (strlen($error)? ' error': '') . '">' .
             (strlen($error)? '<span class="error">' . $error . '</span><br />': '') .
             $element->__toString() . "</div></div><br />\n";
    }
}
Back to top
View user's profile Send private message
mark



Joined: 07 Jan 2007
Posts: 1011

PostPosted: Fri May 30, 2008 12:27 pm    Post subject: Reply with quote

QF2 only has an addElement() method. And groups were replaced by containers.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    PEAR Forum Forum Index -> HTML All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



PEAR Forum topic RSS feed 
Powered by phpBB © 2001, 2005 phpBB Group

Provided by Ministry of Web developement

'Actiemonitor' online projectmanagement software