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:37:19 UTC

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

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

Posted by "Filip S. Adamsen" <fs...@fsadev.com>.
Hi,

Howard changed something a few days ago in 5.0.12, might be what you need:
https://issues.apache.org/jira/browse/TAPESTRY-2320

-Filip

On 2008-04-03 09:55, dhning wrote:
> Josh, thanks you for the response.
> I mistake the validation via ajax in Firefox, the http requests are to download tapestry error images like field-error-marker.gif&error-bever-right.png, sorry about that.
> 
> I have change "onAction" to "onSuccess", but js error still exists in IE, debugger shows me at line 532 of tapestry.js.
> 
> if (! event.result)
>  {
>             domevent.stop(); //  line 532 here
>  }
> 
> Error is "Object doesn't support this property or method". 
> 
> If I disable the debugger, then client validation logic seems run, and show the error bubble, but immediately the form is submitted, I really can't understand, maybe because of js error, the event is not prevented from being submitted.
> 
> My concern: 5.0.11 Client validation of beaneditform works in firefox, but why can not in IE, Opera has the same problem. I also test validation of Form component in these 3 browsers, result seems the same.
> 
> Please help.
> 
> 
> Thanks!
> 
> DH
> 
> 
> ----- Original Message ----- 
> From: "Josh Canfield" <jo...@thedailytube.com>
> To: "Tapestry users" <us...@tapestry.apache.org>
> Sent: Thursday, April 03, 2008 1:47 AM
> Subject: Re: T5: Beaneditform Validation differences between IE6 and firefox2.0?
> 
> 
>> Hi,
>>
>> Why do you think there is an ajax request sent? Last I checked client
>> side validation is done with javascript that is added to the page when
>> it is rendered. I don't use the beaneditform, so I can't be sure but I
>> doubt it's doing validation via ajax.
>>
>> You're catching every action from Usereditor and saving the user. Is
>> that really what you want? Perhaps you should be more selective and
>> only save the user when the form submission is successful?
>> check out
>> http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry/corelib/components/Form.html
>> for info on form events, specifically "success"
>>
>> As for the javascript error in IE... try stepping into it and tell us
>> what object is having the problem.
>>
>> Josh
>>
>> On Wed, Apr 2, 2008 at 4:37 AM, dhning <dh...@gaonline.com.cn> wrote:
>>> 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
>>
>>
>> -- 
>> --
>> TheDailyTube.com. Sign up and get the best new videos on the internet
>> delivered fresh to your inbox.
>>
>> ---------------------------------------------------------------------
>> 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


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

Posted by dhning <dh...@gaonline.com.cn>.
Josh, thanks you for the response.
I mistake the validation via ajax in Firefox, the http requests are to download tapestry error images like field-error-marker.gif&error-bever-right.png, sorry about that.

I have change "onAction" to "onSuccess", but js error still exists in IE, debugger shows me at line 532 of tapestry.js.

if (! event.result)
 {
            domevent.stop(); //  line 532 here
 }

Error is "Object doesn't support this property or method". 

If I disable the debugger, then client validation logic seems run, and show the error bubble, but immediately the form is submitted, I really can't understand, maybe because of js error, the event is not prevented from being submitted.

My concern: 5.0.11 Client validation of beaneditform works in firefox, but why can not in IE, Opera has the same problem. I also test validation of Form component in these 3 browsers, result seems the same.

Please help.


Thanks!

DH


----- Original Message ----- 
From: "Josh Canfield" <jo...@thedailytube.com>
To: "Tapestry users" <us...@tapestry.apache.org>
Sent: Thursday, April 03, 2008 1:47 AM
Subject: Re: T5: Beaneditform Validation differences between IE6 and firefox2.0?


> Hi,
> 
> Why do you think there is an ajax request sent? Last I checked client
> side validation is done with javascript that is added to the page when
> it is rendered. I don't use the beaneditform, so I can't be sure but I
> doubt it's doing validation via ajax.
> 
> You're catching every action from Usereditor and saving the user. Is
> that really what you want? Perhaps you should be more selective and
> only save the user when the form submission is successful?
> check out
> http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry/corelib/components/Form.html
> for info on form events, specifically "success"
> 
> As for the javascript error in IE... try stepping into it and tell us
> what object is having the problem.
> 
> Josh
> 
> On Wed, Apr 2, 2008 at 4:37 AM, dhning <dh...@gaonline.com.cn> wrote:
>> 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
> 
> 
> 
> -- 
> --
> TheDailyTube.com. Sign up and get the best new videos on the internet
> delivered fresh to your inbox.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
>

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

Posted by Josh Canfield <jo...@thedailytube.com>.
Hi,

Why do you think there is an ajax request sent? Last I checked client
side validation is done with javascript that is added to the page when
it is rendered. I don't use the beaneditform, so I can't be sure but I
doubt it's doing validation via ajax.

You're catching every action from Usereditor and saving the user. Is
that really what you want? Perhaps you should be more selective and
only save the user when the form submission is successful?
check out
http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry/corelib/components/Form.html
for info on form events, specifically "success"

As for the javascript error in IE... try stepping into it and tell us
what object is having the problem.

Josh

On Wed, Apr 2, 2008 at 4:37 AM, dhning <dh...@gaonline.com.cn> wrote:
> 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



-- 
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

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


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

Posted by dhning <dh...@gaonline.com.cn>.
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