RV: [Chameleon] Custom Widget, read value of input text in Draw Publish

Julien-Samuel Lacroix jlacroix at mapgears.com
Tue Jan 9 09:37:19 EST 2007


Hi,
To read any form variable anywhere in a widget use this:
$this->lb = $this->getVar('especie');

There's also the function $this->isVarSet('especie') that is used to 
know if a variable is set or not in the form variables.

Julien


Ines wrote:
> Thanks again, it works with: $shp->set('text', 'My Place');
> I'll make the tutorial to add it to the wiki.
> 
> 
> I need to solve another thing now. I created an "input text" in the function
> "Draw publish". And I need to know how to take the value from that input
> text. I tried  with the POST method in  "ParseURL" function but it don´t
> read the value of the input text. Do you know How can I read the value of
> the input text in the widget? I need to take that value in the Parse URL
> function. I need to write something in the input text, and when I click the
> widget button, take that value in Parse URL to use it like a variable.
> 
> function DrawPublish()
>     {
>         // init vars
>         $szReturn = "<font color='#000000' size='2' face='Arial, Helvetica,
> sans-serif'>Search by scientific name </font><input type='text'
> name='especie'>        ";
> 
>         // execute parent
>         $szReturn .= parent::DrawPublish();
> 
>         // return
>         return $szReturn;
> 
>     // end DrawPublish() function
>     }
> 
> In Parse URL I think it could be:
> 
> $this->lb=$_POST[especie];   //---------------> But it don't work, POST
> don't read the value of "especie" input.
> 
> $poLayer = $this->moMapObject->oMap->getLayerByName('pointlatlon');
> $poLayer->set("status", MS_ON);
> $pt = ms_newPointObj();
> $ln = ms_newLineObj();
> $shp = ms_newShapeObj(MS_SHAPE_POINT);
> $shp->set("text", $this->lb);
> $pt->setXY($this->x,$this->y);
> $ln->add($pt);
> $shp->add($ln);
> $poLayer->addFeature($shp);
> 
> 
> Thank you very much
> Ines
> 
> 
> 
> 
> 
> Hi,
> Ines wrote:
> 
>>Hello, thank you very much!!! I can´t believe it. I can see the point in
> 
> the
> 
>>map!! my widget is working very very well now. It is really a success.
> 
> Again
> 
>>thank you. I want to collaborate with chemeleon making a little manual to
>>make the points dynamic with a widget if you want to publish it like an
>>example of "Draw point layer dynamic in the map with widgets". What do you
>>think?
> 
> 
> Great idea! You can probably easily add that to the wiki:
> http://chameleon-tiki.maptools.org/tiki-index.php
> 
> 
>>Now I need to ask you, I need to show a text with the point in the widget.
>>Like:
>>TEXT "My Place"     in the point layer of the file.map.
> 
> 
> Does $shp->set('text', 'My Place'); works?
> 
> Julien
> --
> Julien-Samuel Lacroix
> Mapgears
> http://www.mapgears.com/
> 
> _______________________________________________
> Chameleon mailing list
> Chameleon at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/chameleon

-- 
Julien-Samuel Lacroix
Mapgears
http://www.mapgears.com/


More information about the Chameleon mailing list