[EP-tech] Re: Simple(?) eprints make_element question
Ian Stuart
Ian.Stuart at ed.ac.uk
Wed Apr 16 14:21:24 BST 2014
I was going to say, this is how I've done Radio Buttons, with setting
the right selected element:
foreach
my $card ( sort { $a->get_value('email') cmp
$b->get_value('email') }
@postcards )
{
my $div = $session->make_element('div');
my $label = $session->make_element('label');
$div->appendChild($label);
my $input = $session->render_input_field(
type => 'radio',
name => 'rjb_email',
value => $card->get_value('email'),
class => 'ep_form_checkbox',
onChange => 'autoSubmitEmail();'
);
$label->appendChild($input);
$label->appendChild(
$session->make_text(
q{ }
. $card->get_value('email')
. ' (watching '
. scalar @{ $card->get_value('repos') }
. ' repositories) '
)
);
my $href = $session->render_link(
$session->get_uri . '?remove_email=' . $card->get_value('email') );
my $span
= $session->make_element( 'span', 'class' =>
'ep_form_field_help' );
$href->appendChild( $session->html_phrase('subscriber_remove') );
$span->appendChild( $session->make_text('<') );
$span->appendChild($href);
$span->appendChild( $session->make_text('>') );
$label->appendChild($span);
# This is where we know what card we're looking at
# (and yes, we're cheating - we should use
# $subscriber->get_postcard($current_email) - but we're here anyway
if ( $card->get_value('email') eq $current_email ) {
$input->setAttribute( 'checked', 'checked' );
$current_card = $card;
}
$fieldset->appendChild($div);
} ## end foreach my $card ( sort { $a...})
--
Ian Stuart.
Developer: ORI, RJ-Broker, and OpenDepot.org
Bibliographics and Multimedia Service Delivery team,
EDINA,
The University of Edinburgh.
http://edina.ac.uk/
This email was sent via the University of Edinburgh.
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.
More information about the Eprints-tech
mailing list