Re: Second form with QuickForm

From: Date: Fri, 30 May 2008 23:54:50 +0000
Subject: Re: Second form with QuickForm
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-28960@lists.php.net to get a copy of this message
Ok, there seem to be another problem: When setting trackSubmit to TRUE the form is not validated anymore - even if there is no other form on the page. My code is as followed: $frmLogin = new HTML_QuickForm('loginform','post', $_SERVER['REQUEST_URI'], '', null, TRUE); $frmLogin->addElement('text', 'username', 'Username'); $frmLogin->addElement('password', 'password', 'Password'); $frmLogin->addElement('submit', 'loginbutton', 'Send'); $frmLogin->applyFilter('username', 'trim'); $frmLogin->applyFilter('password', 'trim'); if ( $frmLogin->validate() ) {
    echo 'just a test output';
} else {
    $renderer =& new HTML_QuickForm_Renderer_ArraySmarty($smarty);
    $frmLogin->accept($renderer);
    $smarty->assign('loginform', $renderer->toArray());
} Is there anything wrong? I tried to add a rule for checking username as required on the client, but that was not executed too. Thanks everyone for the help, Bernhard. PS: Sorry for the mail sent twice - wrong key combination ;) Hollenbeck, Dan schrieb:
Bernhard, Without seeing your code this is what I would suggest. 1. Make sure you are calling (instantiating) the QuickForm class with the 'trackSubmit' set to TRUE. See the documentation: http://pear.php.net/manual/en/package.html.html-quickform.html-quickform .html-quickform.php 2. Make sure you only freeze the form when that form has been sumitted: if($frmLogin->validate()){ $frmLogin->freeze(); .... } if($frmContact->validate()){ $frmContact->freeze(); ... } Daniel Hollenbeck -----Original Message----- From: Bernhard Harb [mailto:pear@harb-online.com] Sent: Friday, May 30, 2008 5:31 AM To: pear-general@lists.php.net Subject: [PEAR] Second form with QuickForm Good afternoon! I use PEAR in combination with SMARTY quite extensive for my current project, but now I have a strange problem and no idea how to solve it: Simplified my main page has a login form as a DIV wich is always visible. A second DIV is reserverd for the content of the page. When using HTML_quickForm in the second div to show a form and this one is sent, the login form becomes frozen as well as the form in the second div (f.e. a contact form). This behavior is right for the contact form, but why is the loginform frozen too? I use seperate quickform instances ($frmLogin, $frmContact) for the two forms, so that should not be the reason. Any idea, what's wrong? Thanks a lot, Bernhard. -- PEAR General Mailing List (http://pear.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.pear.general (#28960) next »