X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fedit%2Felements%2Fedit.html;h=94bf6eecdec5639296ab16463f86ddb08298b2d1;hp=120c03a3c5c83581feae6d0ca9882d4168891884;hb=c738a3c4923774b64960aa87fa58bd0751487edb;hpb=aaad08cae3a0d46d012de5b78360101cda836c30 diff --git a/httemplate/edit/elements/edit.html b/httemplate/edit/elements/edit.html index 120c03a3c..94bf6eecd 100644 --- a/httemplate/edit/elements/edit.html +++ b/httemplate/edit/elements/edit.html @@ -16,6 +16,18 @@ # # 'menubar' => '', #menubar arrayref # + # #run when re-displaying with an error + # 'error_callback' => sub { my $cgi, $object = @_; }, + # + # #run when editing + # 'edit_callback' => sub { my $cgi, $object = @_; }, + # + # #run when adding + # 'new_callback' => sub { my $cgi, $object = @_; }, + # + # #broken'html_table_bottom' => '', #string or listref of additinal HTML to + # #add before + # # 'viewall_dir' => '', #'search' or 'browse', defaults to 'search' # # 'html_bottom' => '', #string @@ -43,16 +55,25 @@ map { $_ => scalar($cgi->param($_)) } fields($table) }); + &{$opt{'error_callback'}}($cgi, $object) + if $opt{'error_callback'}; + } elsif ( $cgi->keywords ) { #editing my( $query ) = $cgi->keywords; $query =~ /^(\d+)$/; $object = qsearchs( $table, { $pkey => $1 } ); + &{$opt{'edit_callback'}}($cgi, $object) + if $opt{'edit_callback'}; + } else { #adding $object = $class->new( {} ); + &{$opt{'new_callback'}}($cgi, $object) + if $opt{'new_callback'}; + } my $action = $object->$pkey() ? 'Edit' : 'Add';