You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by dhning <dh...@gaonline.com.cn> on 2008/04/02 13:43:12 UTC

Re: Beaneditform Validation differences between IE6 and firefox2.0?

Forgot to mention that the js error source in tapestry.js:

if (! event.result)
        {
            domevent.stop(); // debugger shows me the error here. 532 line in tapestry.js
        }
        else
        {
            this.form.fire("form:prepareforsubmit");
        }

        return event.result;


Thanks!

DH


----- Original Message ----- 
From: "dhning" <dh...@gaonline.com.cn>
To: "Tapestry users" <us...@tapestry.apache.org>
Sent: Wednesday, April 02, 2008 7:37 PM
Subject: T5: Beaneditform Validation differences between IE6 and firefox2.0?


> Hi, 
> 
> I just begin to learn T5 and simply use component t:beaneditform to create/edit a simple entity User. But I found that the validation behavior are different in IE6 and firefox.
> Please help. My tapestry version is 5.0.11.
> 
> My entity code:
> 
> public class User implements Serializable {
>    private String username;
>    private String password;
> 
>    @Validate("required") // for tapestry, add require validation.
>    public String getPassword() {
>        return password;
>    }
>    // other setter & getter
> }
> 
> My page class code:
> 
> public class CreateUser extends BasePage { // my base page to inject the entity service
> 
>    private User user; // not persistent
> 
>    public User getUser() {
>        return this.user;
>    }
> 
>    public void setUser(User user) {
>        this.user = user;
>    }
>    
>    @InjectPage
>    private UserList listPage;
>    
>    UserList onActionFromUsereditor() {
>     getEntityService().save(user);
>        
>        return this.listPage;
>    }
> }
> 
> I don't write any validation in page class, such as onSuccess ...
> 
> My template code:
> <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
>    <head>
> 
>        <title>t5first Start Page</title>
>    </head>
>    <body>
>        <h1>Create User</h1>
>  
>   <t:beaneditform t:id="usereditor" t:object="user" t:submitLabel="message:button.save"/>
> 
>    </body>
> </html>
> 
> Case: I input nothing, and click "submit" button.
> In firefox everything works. A ajax request is sent, later a popup prompt that "password" can't be null.
> But in IE6(I have installed VS2005 studio as debugger), when I click "submit" button, a js error happens: Object doesn't support this property or method and ask me whether to debug or not.
> I choose not, then the "onActionFromUsereditor" is invoked and page navigates to the user list page. An user record has been added to DB!!!.
> 
> Would you please help?
> 
> BTW, T4's client validation is very good without sending ajax request, is there a way for T5 to implement such feature?
> 
> Thanks!
> DH