One more question:
How to trigger the exectution of js function. For exmaple, before the code
was like that directly n the tml page:

<t:if test="error">
                                                        <div class="info 
i-error">
                                                                Some hard-coded 
meessage
                                                        </div>
                                                        
</t:if>
So I tried to apply your technics, but the js function is never loaded (I
have no errors displayed when submitting the form):
@IncludeJavaScriptLibrary(value = { "context:/static/javascript/password.js"
})
public class ForgottenPassword {
...
@Property
    private boolean error;

@BeginRender
    void addJsLibs() {
        if (error) {
            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);
        }
    }
...
}
And in JS file password.js:

Tapestry.Initializer.load = function loadPass(jsonObject){
..
passError.html(jsonObject.m1);
...
}
loadPass(jsonObject);

Why?






--
View this message in context: 
http://tapestry.1045711.n5.nabble.com/Difference-between-renderSupport-addScript-and-JSON-addInit-function-JSON-Object-tp5105620p5125897.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

Reply via email to