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

Oliver Christen oliver.christen at camptocamp.com
Mon Dec 3 02:57:54 EST 2007


Hi

first it would be interesting to know what the real error is.
if you have set the variable profile=development in your client.ini, when an 
error happen you should have the message "an error occured, clic ok to 
display the message" or something like that. The error returned will then be 
displayed at the bottom of the page or so.

Another thing, to update an element of the page by javascript, you need to 
add an "id" to your element, the value is usualy the same as the "name"
$('selection') means "get the element whose id is 'selection'.

And for textara, you cant use .value to set the value. You must use 
.innerHTML

regards
Oliver



> 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
>>
>
> _______________________________________________
> 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