<input name="<%$submission->{alias}.$widget->{widget_name}%>"
	id="<%$submission->{alias}.$widget->{widget_name}%>"
% if (defined $value) {
	value="<%$value%>"
% }
% if (defined $widget->{args}{onblur}) {
	onblur="<%$widget->{args}{onblur}%>"
% }
% if (defined $widget->{args}{onfocus}) {
	onfocus="<%$widget->{args}{onfocus}%>"
% }
% if (defined $widget->{args}{onselect}) {
	onselect="<%$widget->{args}{onselect}%>"
% }
% if (defined $widget->{args}{onchange}) {
	onchange="<%$widget->{args}{onchange}%>"
% }
% while (my ($key, $val) = each %args) {
	<%$key%>="<%$val%>"
% }
/>
<%init>
my $submission = $context->submission;
my $widget = Contentment::Form::Widget->build(
	form_name   => $submission->{form_name},
	widget_name => $name,
	class       => 'Contentment::Form::Widget::Input',
	args        => {
		default  => $default,
		override => $override,
		onblur   => $onblur,
		onfocus  => $onfocus,
		onselect => $onselect,
		onchange => $onchange,
		args     => \%args,
	},
);

my $value;
if (!$widget->{args}{override} && $submission->{vars}{$widget->{widget_name}}) {
	$value = $submission->{vars}{$widget->{widget_name}};
} elsif ($widget->{args}{default}) {
	$value = $widget->{args}{default};
}
</%init>
<%args>
$name
$default  => undef
$override => undef
$onblur   => undef
$onfocus  => undef
$onselect => undef
$onchange => undef
%args     => {}
</%args>
