HTML::Widget::JavaScript::Constraint::All - JavaScript All Constraint


HTML-Widget-JavaScript documentation Contained in the HTML-Widget-JavaScript distribution.

Index


Code Index:

NAME

Top

HTML::Widget::JavaScript::Constraint::All - JavaScript All Constraint

VERSION

Top

Version 0.02

SYNOPSIS

Top

JavaScript All Constraint.

METHODS

Top

See HTML::Widget::Constraint::All.

$self->emit_javascript($var_name)

Emits this constraint's JavaScript validation code.

AUTHOR

Top

Nilson Santos Figueiredo Júnior, <nilsonsfj at cpan.org>

BUGS

Top

Please report any bugs or feature requests directly to the author. If you ask nicely it will probably get fixed or implemented.

COPYRIGHT & LICENSE

Top


HTML-Widget-JavaScript documentation Contained in the HTML-Widget-JavaScript distribution.
package HTML::Widget::JavaScript::Constraint::All;

use warnings;
use strict;

use base 'HTML::Widget::Constraint::All';

our $VERSION = '0.02';

sub emit_javascript {
	my ($self, $var_name) = @_;
	
	my @js_constraints;

	my $not = $self->not ? '' : '!';

	return "($not(" . join(' && ', map {"${var_name}.$_.value != ''"} @{$self->names}) . '))';
}

1; # End of HTML::Widget::JavaScript::Constraint