[Cartoweb-users] Problem with Checkboxes
Carolin Latze
carolin.latze at unifr.ch
Thu Sep 13 07:23:29 EDT 2007
Hi,
hm.... I really forgot that :-/ Very stupid error, I know...
But I have another question regarding the checkboxes. The line
this->p1 = isset($request['prod1']) ? $request['prod1'] : '';
returns always an empty string, even if the checkbox has been checked.
Is there also problem with my syntax in 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}
I saw, that there are also checkboxes in the demoEdit sample project,
but I do not really understand it and was therefore not able to adapt it
to my needs.
Thanks in Advance
Carolin
Oliver Christen wrote:
> 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
>>
>
--
Carolin Latze
Research Assistant
Department of Computer Science
Boulevard de Pérolles 90
CH-1700 Fribourg
phone: +41 26 300 83 30
More information about the Cartoweb-users
mailing list