[Cartoweb-users] How to assign value to a textarea out of ajaxable plugin

Carolin Latze carolin.latze at unifr.ch
Fri Nov 30 14:30:46 EST 2007


Just a little remark... I studied the AjaxHandler and saw that the
"received response is malformed" error is generated, if the response is
no XML... how can that be? I think I have no influence on that...

Bye
Carolin

LATZE Carolin wrote:
>
> Hi all,
>
> I know, that this might be a dumb question, but I'm lost and I don't
> find any solution by myself. I wrote my own plugin, which should write
> something into a textarea if the user selects something in a dropdown
> list. Without Ajax, no problem, but I can't find out how to do it with
> Ajax. Here are the details:
>
> In cartoclient.tpl I defined the dropdown menu and the textarea:
>
> <select name="col"
> onchange="javascript:CartoWeb.trigger('refsel.submit','formItemSelected()');">
> {html_options values=$col_values output=$col_output selected=$col}
> </select><br />
> Selection:<br /><textarea type="text" name="selection" cols="30"
> rows="10" >{$current_selection}</textarea><br />
>
>
> Then I defined a new plugin called refsel, which implements ajaxable.
> The implementing methods:
>
>     /*
>      * Ajaxable methods
>      */
>      public function ajaxHandleAction($actionName,PluginEnabler
> $pluginEnabler){
>          switch($actionName){
>              case refsel.submit:
>                  $pluginsDirectives->disableCoreplugins();
>                  $pluginsDirectives->enablePlugin('refsel');
>              break;
>          }
>      }
>     
>      public function ajaxGetPluginResponse(AjaxPluginResponse
> $ajaxPluginResponse){
>          $ajaxPluginResponse->addVariable('sel','HelloWorld');
>      }
>
> In refsel.ajax.js I defined:
>
> AjaxPlugins.refsel = {
>     handleResponse: function(pluginOutput){
>         $('selection').current_selection=pluginOutput.variables.sel;
>     }
> };
>
> /*
>  * Plugin Actions
>  */
>  AjaxPlugins.refsel.Actions = {};
>  AjaxPlugins.refsel.Actions.submit = {
>      buildPostRequest: function(argObject){
>          return AjaxHandler.buildPostRequest();
>      },
>      buildGetRequest: function(argObject){
>          return '';
>      },
>      onBeforeAjaxCall: function(argObject){
>     },
>     onAfterAjaxCall: function(argObject){
>     }
>  }
>
> I know, there has to be something wrong with handleResponse, since I get
>
> Error: AjaxHandler.actionRequest(): received response is malformed!
>
> when I try to use the plugin. I tried several different versions of
> handleResponse, but I can't find out how to do it the right way.
>
> Is there somebody, who can help me with this little (but annoying)
> problem? I would be very grateful :-)
>
> Thanks in Advance!
> Carolin
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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