Convert Phone and DateTime to headTags

This commit is contained in:
Colin Kuskie 2010-09-14 14:02:37 -07:00
parent e02844d00c
commit 3594bccb7c
2 changed files with 39 additions and 13 deletions

View file

@ -199,6 +199,31 @@ sub getValueAsHtml {
#-------------------------------------------------------------------
=head2 headTags ( )
Set the head tags for this form plugin
=cut
sub headTags {
my $self = shift;
my $session = $self->session;
my $style = $session->style;
my $url = $session->url;
$style->setLink($url->extras('yui/build/calendar/assets/skins/sam/calendar.css'), { rel=>"stylesheet", type=>"text/css", media=>"all" });
$style->setScript($url->extras('/yui/build/utilities/utilities.js'), { type => 'text/javascript' });
$style->setScript($url->extras('yui/build/json/json-min.js'), { type => 'text/javascript' });
$style->setScript($url->extras('yui/build/yahoo/yahoo-min.js'), { type => 'text/javascript' });
$style->setScript($url->extras('yui/build/dom/dom-min.js'), { type => 'text/javascript' });
$style->setScript($url->extras('yui/build/event/event-min.js'), { type => 'text/javascript' });
$style->setScript($url->extras('yui/build/calendar/calendar-min.js'), { type => 'text/javascript' });
$style->setScript($url->extras('yui-webgui/build/i18n/i18n.js' ), { type => 'text/javascript' });
$style->setScript($url->extras('yui-webgui/build/datepicker/datepicker.js'),{ type => 'text/javascript' });
}
#-------------------------------------------------------------------
=head2 isDynamicCompatible ( )
A class method that returns a boolean indicating whether this control is compatible with the DynamicField control.
@ -224,18 +249,7 @@ sub toHtml {
$value = WebGUI::DateTime->new($session,0) if $value eq '';
$value = $value->set_time_zone($self->get("timeZone"))->strftime("%Y-%m-%d %H:%M:%S");
my $style = $session->style;
my $url = $session->url;
$style->setLink($url->extras('yui/build/calendar/assets/skins/sam/calendar.css'), { rel=>"stylesheet", type=>"text/css", media=>"all" });
$style->setScript($url->extras('/yui/build/utilities/utilities.js'), { type => 'text/javascript' });
$style->setScript($url->extras('yui/build/json/json-min.js'), { type => 'text/javascript' });
$style->setScript($url->extras('yui/build/yahoo/yahoo-min.js'), { type => 'text/javascript' });
$style->setScript($url->extras('yui/build/dom/dom-min.js'), { type => 'text/javascript' });
$style->setScript($url->extras('yui/build/event/event-min.js'), { type => 'text/javascript' });
$style->setScript($url->extras('yui/build/calendar/calendar-min.js'), { type => 'text/javascript' });
$style->setScript($url->extras('yui-webgui/build/i18n/i18n.js' ), { type => 'text/javascript' });
$style->setScript($url->extras('yui-webgui/build/datepicker/datepicker.js'),{ type => 'text/javascript' });
$self->headTags;
return WebGUI::Form::Text->new($self->session,
name => $self->get("name"),
value => $value,

View file

@ -72,6 +72,19 @@ sub getValue {
#-------------------------------------------------------------------
=head2 headTags ( )
Set the head tags for this form plugin
=cut
sub headTags {
my $self = shift;
$self->session->style->setScript($self->session->url->extras('inputCheck.js'),{ type=>'text/javascript' });
}
#-------------------------------------------------------------------
=head2 isDynamicCompatible ( )
A class method that returns a boolean indicating whether this control is compatible with the DynamicField control.
@ -92,7 +105,6 @@ Renders a phone number field.
sub toHtml {
my $self = shift;
$self->session->style->setScript($self->session->url->extras('inputCheck.js'),{ type=>'text/javascript' });
$self->set("extras", $self->get('extras') . ' onkeyup="doInputCheck(document.getElementById(\''.$self->get("id").'\'),\'x.0123456789-()+ \')" ');
return $self->SUPER::toHtml;
}