You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by baptiste <ba...@atos.net> on 2012/06/20 09:56:16 UTC

Re: Difference between renderSupport.addScript and JSON addInit(function, JSON Object)

It doesn't work for me.

In java : 
   @IncludeJavaScriptLibrary({ "context:static/javascript/address.js" })
  
   @Environmental
    private RenderSupport renderSupport;

    @BeginRender
    void addJsLibs() {
    	log.debug("BEGIN addJsLibs");
	JSONObject jsonObject = new JSONObject();
	jsonObject.put("m1", messages.get("new_delivery_address"));
	jsonObject.put("m2", messages.get("js.error.address.empty"));
	jsonObject.put("m3", messages.get("js.error.receiving.person.empty"));
	jsonObject.put("m4", messages.get("js.error.street.empty"));
	jsonObject.put("m5", messages.get("js.error.house.empty"));
	jsonObject.put("m6", messages.get("js.error.postcode.empty"));
	jsonObject.put("m7", messages.get("js.error.postcode.wrong"));
	jsonObject.put("m8", messages.get("js.error.city.empty"));
	jsonObject.put("m9", messages.get("js.error.special.chars.not_accepted"));
	jsonObject.put("m10", messages.get("js.error.floor.empty"));
	jsonObject.put("m11", messages.get("js.error.floor.wrong"));
	jsonObject.put("m12", messages.get("js.error.elevator.empty"));
	renderSupport.addInit("loadAddresse", jsonObject);
	log.debug("END addJsLibs");
    }

in address.js:
Tapestry.Initializer.loadAddresse = function loadAddresse(jsonObject){
...
}
loadAddresse(jsonObject);

In browser console:
loadAddresse is not defined
and method in loadAddresse can never be called

--
View this message in context: http://tapestry.1045711.n5.nabble.com/Difference-between-renderSupport-addScript-and-JSON-addInit-function-JSON-Object-tp5105620p5713987.html
Sent from the Tapestry - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Difference between renderSupport.addScript and JSON addInit(function, JSON Object)

Posted by Steve Eynon <st...@alienfactory.co.uk>.
in address.js remove the last call to loadAddresse. i.e. just have

Tapestry.Initializer.loadAddresse = function loadAddresse(jsonObject){
...
}

it is probably that last surplus : loadAddresse(jsonObject); that
caused the JS error ('cos there is no global function called
loadAddresse) which then disabled JavaScript for the rest of the page
load.

Steve.




On 20 June 2012 15:56, baptiste <ba...@atos.net> wrote:
> It doesn't work for me.
>
> In java :
>   @IncludeJavaScriptLibrary({ "context:static/javascript/address.js" })
>
>   @Environmental
>    private RenderSupport renderSupport;
>
>    @BeginRender
>    void addJsLibs() {
>        log.debug("BEGIN addJsLibs");
>        JSONObject jsonObject = new JSONObject();
>        jsonObject.put("m1", messages.get("new_delivery_address"));
>        jsonObject.put("m2", messages.get("js.error.address.empty"));
>        jsonObject.put("m3", messages.get("js.error.receiving.person.empty"));
>        jsonObject.put("m4", messages.get("js.error.street.empty"));
>        jsonObject.put("m5", messages.get("js.error.house.empty"));
>        jsonObject.put("m6", messages.get("js.error.postcode.empty"));
>        jsonObject.put("m7", messages.get("js.error.postcode.wrong"));
>        jsonObject.put("m8", messages.get("js.error.city.empty"));
>        jsonObject.put("m9", messages.get("js.error.special.chars.not_accepted"));
>        jsonObject.put("m10", messages.get("js.error.floor.empty"));
>        jsonObject.put("m11", messages.get("js.error.floor.wrong"));
>        jsonObject.put("m12", messages.get("js.error.elevator.empty"));
>        renderSupport.addInit("loadAddresse", jsonObject);
>        log.debug("END addJsLibs");
>    }
>
> in address.js:
> Tapestry.Initializer.loadAddresse = function loadAddresse(jsonObject){
> ...
> }
> loadAddresse(jsonObject);
>
> In browser console:
> loadAddresse is not defined
> and method in loadAddresse can never be called
>
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/Difference-between-renderSupport-addScript-and-JSON-addInit-function-JSON-Object-tp5105620p5713987.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org