HTML-GUI

 view release on metacpan or  search on metacpan

lib/HTML/GUI/fieldset.pm  view on Meta::CPAN

	my %tagProp=();
	my %styleProp=();
  

	if (exists $self->{display} && 0==$self->{display}){
		$styleProp{display} = 'none';
	}

	$tagProp{style} = $self->getStyleContent(\%styleProp);
	$tagProp{id} = $self->{id};
	my $legendHtml = '';
	if (exists $self->{label}){
			$legendHtml = $self->getHtmlTag("legend",
																		undef,
																		$self->escapeHtml($self->{label}));
	}
	return $self->getHtmlTag( "fieldset",
														\%tagProp,
														$legendHtml
														.$self->SUPER::getHtml()) ;
}



=head1 AUTHOR

Jean-Christian Hassler, C<< <jhassler at free.fr> >>

=head1 BUGS

lib/HTML/GUI/templates/css/base.css  view on Meta::CPAN

fieldset {
		background-color:#E5ECFF;
		border-color:#BFD1FF;
		margin			: 0.4em 0.5em;
		padding			: 1em 1ex;
}
form {
		background-color : #ffffff;
		max-width : 65em;
}
legend {
		font-weight : bold;
		font-size:   1.4em;
		padding : 0.1em;
}
.btn:hover {
		background-color : #ffce58;
}
.btn {
		text-align : center;
		width: 8em; 

lib/HTML/GUI/templates/test.html  view on Meta::CPAN

<div class="errorList">
<h2 class="errorList">Des erreurs sont survenues</h2>
<dl class="errorList">
		<dt>Général</dt><dd>Un problème à la technique est survenu, ce n'est pas bien... Il peut s'agir d'un effet de bord d'une opération de maintenance. Si le problème ѕe produit une nouvelle fois, contactez le support.</dd>
		<dt>adresse (Ligne 1) :</dt><dd> il en faut une. <a href="#adr1">Corriger</a> </dd>
		<dt>Age du patient</dt>
				<dd>L'âge ne peut être supérieur à 1000 ans </dd>
				<dd>l'âge doit être saisi en années</dd>
		</dl>
</div>
		<fieldset><legend>Identité du patient</legend>
				<p class="float"><label for="bla" class="plabel">label1</label>
				<input id="bla" name="bla" value="je vai!! éàüù\" type="text"/>
				</p>
				<p class="float"><label for="adr1">première ligne d'adresse</label>
				<input id="adr1" name="adr1" value="2" type="text"/>
				</p>
				<br class="spacer"/>
				<p class="float"><label for="bl1">Ma deuxième ligne d'adresse qui est très longue</label>
				<input id="bl1" name="bl1" value="2" type="text"/>
				</p>
				<p class="float"><label for="bl2">L'âge du capitaine pour ne rien perdre</label>
				<input id="bl2" name="bl2" value="2" type="text"/>
				</p>
		</fieldset>
		<fieldset><legend>Critère annexes</legend>
				<p class="float"><label for="bla" class="plabel">Age officiel</label>
				<input id="bla" name="bla" value="56" type="text"/>
				</p>
				<br class="spacer"/>
				<p class="float"><label for="bl2">Raison sociale principale</label>
				<input id="bl2" name="bl2" value="SARL" type="text"/>
				</p>
				<br class="spacer"/>
				<p class="float"><label for="bl4">A réglé toutes ses séances</label>
				<input class="ckbx" id="bl4" name="bl4" value="Y" type="checkbox"/>

t/04-fieldset.t  view on Meta::CPAN

use strict;
use warnings;

use_ok('HTML::GUI::fieldset');
use_ok('HTML::GUI::text');

my $fieldset = HTML::GUI::fieldset->new({
				id => "my_fieldset",
				label => "my test fieldset"});

is($fieldset->getHtml(),'<fieldset id="my_fieldset"><legend>my test fieldset</legend></fieldset>');

$fieldset->addChild({
				type		=> 'text',
				id			=> "bla",
				label			=> "un premier \" champ",
				constraints => ['integer','required'],
				value=> 'je vais vous manger !! éàüù"""\'',
		});
my $textInput = HTML::GUI::text->new({
				id			=> "textObject",

t/04-fieldset.t  view on Meta::CPAN

my $txtInput = $fieldset->getElementById("bla");

$txtInput->setValue(2) ;

ok($fieldset->validate(),"The constraint should be ok now.");

#the id is not mandatory for fieldsets
my $fieldset_without_id = HTML::GUI::fieldset->new( { 
														label => "my test fieldset"});

is($fieldset_without_id->getHtml(),'<fieldset><legend>my test fieldset</legend></fieldset>');


#check the YAML serialization
my $yamlString = $fieldset->serializeToYAML();
ok($yamlString, "check the YAML serialization");
is($yamlString,'--- 
childs: 
  - 
    constraints: 
      - integer



( run in 1.330 second using v1.01-cache-2.11-cpan-49f99fa48dc )