[Cartoweb-users] Cartoweb 3.4 and outline tool

Oliver Christen oliver.christen at camptocamp.com
Mon Jan 7 02:37:33 EST 2008


Hi

you have lost the ajax behaviour because you have modified the 
CartoWeb.trigger

CartoWeb.trigger usualy accept 2 arguments

the first argument tell him what to do if ajax is enabled.
the second argument tell him what to do if ajax is disabled.

so, with CartoWeb.trigger('Outline.AddFeature', 'doSubmit()');, if ajax is 
enabled, it is the 'Outline.AddFeature' function which will be called. The 
'doSubmit()' is only there in case something is wrong and the whole page 
form is being sent in a "normal" way.

Outline.AddFeature basicaly call Ajaxhandler.buildPostRequest which call 
AjaxHelper.buildQueryFrom. This function get all the page input and try to 
get their value. The problem is the textarea elements are not input and 
hence have no value (this is not entirely correct but it is the usual 
behaviour).

So you need to modify a little bit the Outline.ajax.js to manually add the 
textarea value to the generated PostRequest.
something like:

    buildPostRequest: function(argObject) {
        var postRequest = AjaxHandler.buildPostRequest();
        postRequest += ''outline_label_text=' + 
$('outline_label_text').innerHTML;
        return postRequest
    }

you can do an alert of postRequest to see its only a list of parameter name 
and their values param1=value1&param2=value2& ...

regards
Oliver

> Hi Oliver, hi to everybody,
> at least I updateted my projects to the new release. To me cart3.4 is very
> powerful and friendly.
> In my projects I performed some modifications, for example I substituted 
> the
> text area into outline tools so Users can write something more than a 
> simple
> one row of input text. In my first attempt I've only substituted the input
> text with textarea but the content was not printed on the map after typing
> it. Now it works becouse I've substituted the ok button:
>
> Original code:
>
> <input type="text" id="outline_label_text" name="outline_label_text"
>      value="{t}your label{/t}" onfocus="this.value = '';
>      {literal}this.form.onsubmit = function() {doSubmit()};"{/literal} />
>
>       <input type="button" value="{t}ok{/t}" style="margin:1px"
>      onclick="return CartoWeb.trigger('Outline.AddFeature', 
> 'doSubmit()');"
> />
>
> New code:
>
> <TEXTAREA id="outline_label_text" name="outline_label_text" rows="5"
> cols="20"
>   onfocus="this.value = '';
>      {literal}this.form.onsubmit = function() {doSubmit()};"{/literal} >
>      </TEXTAREA>
>
>      <input type="button" value="{t}ok{/t}" style="margin:1px"
>      onclick="doSubmit();" />
>
> In this way I lost the ajax facility, is there a way in order to use a 
> text
> area with ajax?
> About the Outline plugin, is there a way to delete only one symbol and its
> text due to an error ?
>
> THanks to everybody and season gretings.
>
> Giu
> --
> Email.it, the professional e-mail, gratis per te: http://www.email.it/f
>
> Sponsor:
> Realizza i tuoi sogni con i finanziamenti Finatel! Fino a 50.000 Euro 
> senza
> spese in pochissimo tempo. Richiedi Informazioni
>
> Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=7371&d=20071227
>
>
> _______________________________________________
> 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