You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Dimitar Peikov <mi...@rila.bg> on 2000/07/10 18:11:28 UTC

Strange behavior

I use EmbedPerl with MySQL for developing. I think that there is some problem :

-------------------
[$ if ($fdat{op} eq "tele2") $]
  [- $my_details->set_alerting(\%fdat) -]   [# update some field from database
#] [$ endif $]

[-   $details = $my_details->get_alerting; -]
[+ $details->[0] +]   [# returns always right result #]

...

<form ...>

...

<input type="checkbox" name="text_mobile_alert" [$ if ($details->[0] & 1)
$]checked[$ endif $]> Blah-Blah

...

</form>
-------------------

In the following example executing function get_alerting from module return
array with 1 element and its always what must be. But the problem is that
condition in later code (checkbox only) don't work correct. In the example
above the result is always not checked input box when $fdat{op} is set to
"tele2" and always in correct state if not. In both cases the value of
$details->[0] is correct. Any ideas?

-- 
Dimitar Peikov

Re: Strange behavior

Posted by Ilia Lobsanov <il...@lobsanov.com>.
<snip>
>
> <input type="checkbox" name="text_mobile_alert" [$ if ($details->[0] & 1)
> $]checked[$ endif $]> Blah-Blah

instead of that, try this:
[- if ($details->[0] & 1) { $fdat{text_mobile_alert} = 'Blah-Blah' } -]
<input type="checkbox" name="text_mobile_alert" value="Blah-Blah"> Blah-Blah

Regards,

ilia.


RE: Strange behavior

Posted by Gerald Richter <ri...@ecos.de>.
> In the following example executing function get_alerting from
> module return
> array with 1 element and its always what must be. But the problem is that
> condition in later code (checkbox only) don't work correct. In the example
> above the result is always not checked input box when $fdat{op} is set to
> "tele2" and always in correct state if not. In both cases the value of
> $details->[0] is correct. Any ideas?
>

Ilia, already wrote you the correct solution. Embperl sets/removes the
checked attriute based on the value in %fdat.

Gerald


-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de         Voice:    +49 6133 925151
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------