[Cartoweb-users] Problem with Checkboxes

Oliver Christen oliver.christen at camptocamp.com
Thu Sep 13 03:36:44 EDT 2007


Hi

well, have you defined the constants you use ?
because the error message say you did not.

const PROD1 = 'prod1';
...

if you try to directly use the checkbox name, does it work ?

this->p1 = isset($request['prod1']) ? $request['prod1'] : '';

regards
Oliver

> Hi all,
>
> I try to write a plugin, which executes depending on a checkbox
> selection in the Navigation Tab. Therefore, I add to cartoclient.tpl:
>
>      {if $products_active|default:''}
>      <p><b>Show all Companies for a special Product</b></p>
>      Products:<br />
>      <input type="checkbox" id="prod1"
> name="Brotgetreide"/>Brotgetreide<br />
>      <input type="checkbox" id="prod2" name="Butter"/>Butter<br />
>      <input type="checkbox" id="prod3" name="Eier"/>Eier<br />
>      <input type="checkbox" id="prod4" name="Milch"/>Milch<br />
>      {/if}
>
> This works perfect. But now, if I try to read out, which checkbox is
> activated, I use:
>
>            $this->p1 = isset($request[self::PROD1]) ?
> $request[self::PROD1] : '';
>            $this->p2 = isset($request[self::PROD2]) ?
> $request[self::PROD2] : '';
>            $this->p3 = isset($request[self::PROD3]) ?
> $request[self::PROD3] : '';
>            $this->p4 = isset($request[self::PROD4]) ?
> $request[self::PROD4] : '';
>
> in the HttpHandlePostRequest method of the plugin. This leads to the
> following error message:
>
> Fatal error: Undefined class constant 'PROD1' in
> C:\wamp\www\cartoweb3\projects\gis-lag\plugins\products\client\ClientProducts.php
> on line 26
>
> I think, I use the wrong method to read the checkboxes, but I cannot
> find any example how to do it the right way. Does anybody have an idea?
>
> Thanks in Advance
> Carolin
>
> -- 
> Carolin Latze
> Research Assistant
>
> Department of Computer Science
> Boulevard de Pérolles 90
> CH-1700 Fribourg
>
> phone: +41 26 300 83 30
>
>
> _______________________________________________
> Cartoweb-users mailing list
> Cartoweb-users at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/cartoweb-users
> 



More information about the Cartoweb-users mailing list