PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » HTML » HTML_QuickForm_Controller » Bug #1490

setDefaultAction does not work with multiple submits

Details

Submitted2004-05-25 05:34 UTC
Fromjunk at dirocco dot org
StatusBogus
PackageHTML_QuickForm_Controller
PHP Version4.3.5
OSRH Linux 9.0
Roadmaps(Not assigned)

Comments

[2004-05-25 05:34 UTC] junk at dirocco dot org

Description:
------------
If you have more than one submit type button ie in the wizard example included in this distribution the set default action will still default to the first "submit" button instead of to 'next'

Reproduce code:
---------------
$buttons[0] =& HTML_QuickForm::createElement('button', 'cancel', 'Cancel', array('onclick'=>"javascript:location.href='http://www.testdomain.com/';"));
$buttons[1] =& HTML_QuickForm::createElement('submit', $this->getButtonName('back'), '<< Previous step');
$buttons[2] =& HTML_QuickForm::createElement('submit', $this->getButtonName('next'), 'Next step >>');
$this->addGroup($buttons, 'buttons', '', '&nbsp', false);
$this->setDefaultAction('next');

Expected result:
----------------
should follow the path of 'next' instead of 'back'

[2006-09-30 21:27 UTC] giskaard at pobox dot sk

WORKAROUND!
===============

$prev_url =
"onclick=\"window.location='index.php?_qf_page1_display=true'\"";
// $prevnext[] = $this->createElement('submit',
$this->getButtonName('back'), '<< Back');
$prevnext[] = $this->createElement('button', '', '<< Back',
$prev_url);
$prevnext[] = $this->createElement('reset',
'cancel', 'Cancel');
$prevnext[] = $this->createElement('submit',
$this->getButtonName('next'), 'Next >>');
$this->addGroup($prevnext, 'buttons', '', " 
\n", false);

what do you reckon? this gets rid of default browser
behaviour by changing back button type "submit" into type
"button". click back still works as it is handled using
javascript.

is this good enough to integrate into "setDefaultAction" function?

i mean, what is the point using hidden input field when it doesn't work???