I have a strange behavior when usin the above methods to add javascript from inside Java classes. When I use the first one like this:
//java class @Inject private Messages messages; @Environmental private RenderSupport renderSupport; @BeginRender void addJsLibs() { String js = String.format("load(\"%s\", \"%s\", \"%s\", \"%s\", \"%s\", \"%s\", \"%s\", \"%s\", \"%s\", \"%s\", \"%s\", \"%s\");", messages.get("new_delivery_address"), messages.get("js.error.address.empty"), messages.get("js.error.receiving.person.empty"), messages.get("js.error.street.empty"), messages.get("js.error.house.empty"), messages.get("js.error.postcode.empty"), messages.get("js.error.postcode.wrong"), messages.get("js.error.city.empty"), messages.get("js.error.special.chars.not_accepted"), messages.get("js.error.floor.empty"), messages.get("js.error.floor.wrong"), messages.get("js.error.elevator.empty")); renderSupport.addScript(js); } In javascript file: function load(m1,m2,m3,m4,m5,m6,m7,m8,m9,m10,m11,m12){ ... //access to the passed variables, no problems. } It works. When I replace in Java class the above code with JSON object: JSONObject jsonObject = new JSONObject(); jsonObject.put("m1", messages.get("js.error.password.epmpty")); jsonObject.put("m2", messages.get("js.error.confirmed_password.empty")); jsonObject.put("m3", messages.get("js.error.password.not_matched")); jsonObject.put("m4", messages.get("js.error.email.empty")); jsonObject.put("m5", messages.get("js.error.email.wrong")); renderSupport.addInit("loadPass", jsonObject); } In javascript, I just replaced arguments by jsonObject: function load(jsonObject){ ... //acces to the variable in JSON errorText.text(jsonObject.m2) } Why in case of JSON it DOES NOT WORK ? What it depends on. More of that, I have pages and classes wher JSON works as described before, but a lot of cases where it does not. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Difference-between-renderSupport-addScript-and-JSON-addInit-function-JSON-Object-tp5105620p5105620.html Sent from the Tapestry - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org