I think I know why it doesn't work properly. 1. I add a js function from inside the java class using [code] String m1 = messages.get("js_error_password_not_given"); String m2 = messages.get("js_error_no_confirmed_password"); String m3 = messages.get("js_error_password_not_matched"); String m4 = messages.get("js_error_email_not_given"); String m5 = messages.get("js_error_email_wrong");
String js = String.format("loadPass('%s','%s','%s','%s','%s');", m1, m2, m3, m4, m5); System.out.println("-------------- js: " + js); renderSupport.addScript(js); [/code] But inside the password.js file there 2 separate calls to different event: [code] //in password.js function loadPass(m1,m2,m3,m4,m5){ console.log("Inside calling: "+ m1 + ", " + m2 + "," + m3 + "," + m4+ "," + m5 ); jQuery('#changePassLink').click(function(event){ event.preventDefault(); var error = false; var pass = jQuery('#pass'); var pass2 = jQuery('#pass2'); var passError = jQuery('#pass-error'); if (!pass.val()) { error = true; pass.addClass('error'); pass2.removeClass('error'); passError.html(m1); passError.show(); } else if (!pass2.val()) { error = true; pass.removeClass('error'); pass2.addClass('error'); passError.html(m2); passError.show(); } else if (pass.val() != pass2.val()) { error = true; pass.addClass('error'); pass2.addClass('error'); passError.html(m3); passError.show(); } if (error) { return false; } else { try { jQuery(this).closest('form').submit(); }catch(error){ } } }); jQuery('#forgottenPassLink').click(function(event){ event.preventDefault(); var error = false; var email = jQuery('#email'); var emailVal = email.val(); var emailError = jQuery('#email-error'); if (!emailVal) { error = true; email.addClass('error'); emailError.html(m4); emailError.show(); } else if (!isValidMail(emailVal)) { error = true; email.addClass('error'); emailError.html(m5); emailError.show(); } if (error) { return false; } else { try { jQuery(this).closest('form').submit(); }catch(error){ } } }); } loadPass(m1,m2,m3,m4,m5); [/code] I think that when clicking on 'forgottenPassLink' my 5 translated variables simply don't exist. That's why. Now how to add them exactly to the 2 indicated events existing in the js file? -jQuery('#changePassLink').click(function(event) -jQuery('#forgottenPassLink').click(function(event) Thanks -- View this message in context: http://tapestry.1045711.n5.nabble.com/inject-i18-text-in-javascript-variables-jQuery-tp5094388p5096864.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