getEditForm returns FormBuilder and csrfToken should be added by www_edit

This commit is contained in:
Doug Bell 2011-05-05 19:43:32 -05:00
parent f33f4db65b
commit 2e720d6899
2 changed files with 6 additions and 9 deletions

View file

@ -418,7 +418,8 @@ sub www_edit {
return $session->privilege->insufficient() unless $admin->canManage;
my $form = $self->getEditForm;
$form->submit;
$form->addField( 'csrfToken', name => 'csrfToken' );
$form->addField( "submit", name => "submit" );
my $processUrl = $self->session->url->getSiteURL.'/?shop=pay&method=do&do=processTransaction&paymentGatewayId='.$self->getId;
my $output = '<br />';

View file

@ -124,16 +124,16 @@ isa_ok ($cart, 'WebGUI::Shop::Cart', 'getCart returns an instantiated WebGU
my $form = $driver->getEditForm;
isa_ok ($form, 'WebGUI::HTMLForm', 'getEditForm returns an HTMLForm object');
isa_ok ($form, 'WebGUI::FormBuilder', 'getEditForm returns an HTMLForm object');
my $html = $form->print;
my $html = $form->toHtml;
##Any URL is fine, really
my @forms = HTML::Form->parse($html, 'http://www.webgui.org');
is (scalar @forms, 1, 'getEditForm generates just 1 form');
my @inputs = $forms[0]->inputs;
is (scalar @inputs, 18, 'getEditForm: the form has 18 controls');
is (scalar @inputs, 17, 'getEditForm: the form has 18 controls');
my @interestingFeatures;
foreach my $input (@inputs) {
@ -146,11 +146,7 @@ cmp_deeply(
\@interestingFeatures,
[
{
name => 'webguiCsrfToken',
type => 'hidden',
},
{
name => undef,
name => 'submit',
type => 'submit',
},
{