[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SF.net SVN: ledger-smb: [1619] trunk/LedgerSMB/Template/Elements.pm
- Subject: SF.net SVN: ledger-smb: [1619] trunk/LedgerSMB/Template/Elements.pm
- From: ..hidden..
- Date: Sun, 16 Sep 2007 09:40:37 -0700
Revision: 1619
http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=1619&view=rev
Author: tetragon
Date: 2007-09-16 09:40:36 -0700 (Sun, 16 Sep 2007)
Log Message:
-----------
Adding a lightly modified patch from hunmonk
Modified Paths:
--------------
trunk/LedgerSMB/Template/Elements.pm
Modified: trunk/LedgerSMB/Template/Elements.pm
===================================================================
--- trunk/LedgerSMB/Template/Elements.pm 2007-09-16 15:56:12 UTC (rev 1618)
+++ trunk/LedgerSMB/Template/Elements.pm 2007-09-16 16:40:36 UTC (rev 1619)
@@ -77,6 +77,7 @@
attributes => { foo => 'bar' },
values => [ '1', '2', '3'],
labels => [ 'Label one', '', 'Label three'],
+ default_value => '2',
};
=back
@@ -97,7 +98,7 @@
# copy all additional attributes
while ( my ($key, $value) = each(%$radios) ) {
- if ( $key !~ /^(values|labels|id|value)$/ ) {
+ if ( $key !~ /^(values|labels|id|(default_)?value)$/ ) {
$element->{$key} = $value;
}
}
@@ -113,6 +114,12 @@
if ( $radios->{labels}[$i] ) {
$element->{label} = $radios->{labels}[$i];
}
+
+ # Add checked attribute if the default value applies to this element.
+ if ( defined($radios->{default_value}) && $radios->{default_value} eq $radio_value) {
+ $element->{checked} = 'checked';
+ }
+
push @$elements, $element;
$i++;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.