perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Villu Roogna" <realm...@gmail.com>
Subject Re: Problems customizing selected form elements output
Date Fri, 07 Sep 2007 19:45:02 GMT
Hi again,

Well I have partially achieved what I want. I took a good look on the
Embperl::Syntax::* code and documentation again and figured out that I can
do what I want by using _ep_sa (XML::Embperl::DOM::Element::iSetAttribut in
DOM.xs) function instead of Embperl::Cmd::InputCheck.

In case anyone is interested I give here original and replaced code from
EmbperlHTML.pm  (actually I made a new syntax to prevent overwriting core).

original:

$self -> AddTag ('input', ['type', 'name', 'value'], ['src'], ['checked'],
                {
                perlcode =>
                    [
                    'Embperl::Cmd::InputCheck (%$n%, %&*\'name%,
%&*\'value%, %&\'checked%) ;  %&=-type:radio|checkbox% ',
                    #'_ep_sa(%$n%, \'checked\', \'checked\')
if($fdat{%&*\'name%}); %&=-type:radio|checkbox% ',
                    '$idat{%&*\'name%}=$fdat{%&*\'name%} ; _ep_sa(%$n%,
\'value\', exists ($fdat{%&*\'name%})?$fdat{%&*\'name%}:\'\') ;
%&!-value%',
                    '$idat{%&*\'name%}=%&*\'value% ; ',
                    ]
                }) ;

replaced:

 $self -> AddTag ('input', ['type', 'name', 'value', 'checked'], ['src'],
undef,
                {
                perlcode =>
                    [
                    #'Embperl::Cmd::InputCheck (%$n%, %&*\'name%,
%&*\'value%, %&\'checked%) ;  %&=-type:radio|checkbox% ',
                    '_ep_sa(%$n%, \'checked\', \'checked\')
if($fdat{%&*\'name%}); %&=-type:radio|checkbox% ',
                    '$idat{%&*\'name%}=$fdat{%&*\'name%} ; _ep_sa(%$n%,
\'value\', exists ($fdat{%&*\'name%})?$fdat{%&*\'name%}:\'\') ;
%&!-value%',
                    '$idat{%&*\'name%}=%&*\'value% ; ',
                    ]
                }) ;



But now I have another problem.

When I write my html "xhtml" way (I need to do this because I want to send
embperl output to XSLT processor) then checked or checked="checked" in
replaced EmbperlHTML syntax is inserted at the wrong place

For example

<input type="checkbox"  name="c1" value="v1" />

now when I use %fdat magic to check the checkbox embperl generates:

old syntax:
<input type="checkbox" name="c1" value="v1" / checked>
my new modified syntax:
<input type="checkbox" name="c1" value="v1" / checked="checked">

but I need it to generate:

old syntax:
<input type="checkbox" name="c1" value="v1" checked />
my new modified syntax:
<input type="checkbox" name="c1" value="v1" checked="checked" />

So the "checked" is inserted after slash "/", it should be inserted before
it.

What would I have to change  (Embperl::Syntax ?) or something else to insert
slash in correct place?

With kind regards,
Villu

Mime
View raw message