Changeset 174


Ignore:
Timestamp:
05/23/09 17:51:33 (15 years ago)
Author:
nanardon
Message:
  • submit data to db only if form were submit
Location:
LATMOS-Accounts-Web
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Model/AttrForms.pm

    r173 r174  
    240240} 
    241241 
     242sub submit { 
     243    my ($self) = @_; 
     244    return sprintf( 
     245        '<input type="submit" name="%s">', 
     246        $self->escape($self->label), 
     247    ); 
     248} 
     249 
    242250sub set_attrs { 
    243251    my ($self) = @_; 
     252    $self->{c}->req->param($self->label) or return; 
    244253    $self->{object}->set_c_fields( 
    245254        map { 
    246255            $_ => 
    247256                ($attrs->{$_}[1] || '') eq 'checkbox' 
    248                 ? ($self->{c}->req->param($_) ? 1 : undef) 
     257                ? ($self->{c}->req->param($_) ? 1 : 0) 
    249258                : $self->{c}->req->param($_) 
    250         } grep {  
    251             exists $self->{c}->req->params->{$_} 
    252259        } $self->attributes 
    253260    ); 
  • LATMOS-Accounts-Web/root/html/includes/form.tt

    r136 r174  
    1010<tr><th>[% form.attr_label(attr) %]</th><td>[% form.attr_field(attr) %]</td> 
    1111[% IF loop.last %] 
    12 <tr><td colspan=2><input type="submit"></td></tr> 
     12<tr><td colspan=2>[% form.submit %]</td></tr> 
    1313</table> 
    1414</form> 
Note: See TracChangeset for help on using the changeset viewer.