How to enable the client side validation?

2008-03-26 Thread Chen Chunwei
Hi all,

just as title

Thanks.

Talos

Re: How to enable the client side validation?

2008-03-26 Thread Nils-Helge Garli Hegvik
http://struts.apache.org/2.x/docs/client-side-validation.html

Nils-H

On Wed, Mar 26, 2008 at 9:34 AM, Chen Chunwei
[EMAIL PROTECTED] wrote:
 Hi all,

  just as title

  Thanks.

  Talos

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: How to enable the client side validation?

2008-03-26 Thread Chen Chunwei
My struts version is 1.1. And I tried to add html:javascript 
formName=submitForm / in my jsp file which needs validation. But it seems 
not working.

Talos

- Original Message - 
From: Nils-Helge Garli Hegvik [EMAIL PROTECTED]
To: Struts Users Mailing List user@struts.apache.org
Sent: Wednesday, March 26, 2008 4:39 PM
Subject: Re: How to enable the client side validation?


http://struts.apache.org/2.x/docs/client-side-validation.html

Nils-H

On Wed, Mar 26, 2008 at 9:34 AM, Chen Chunwei
[EMAIL PROTECTED] wrote:
 Hi all,

  just as title

  Thanks.

  Talos

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: How to enable the client side validation?

2008-03-26 Thread Chen Chunwei
Thanks Antonio

As I said, I've already used html:javascript. Of course, I've alse done the 
other stuff found in the document you refer to (offline version). But it does 
not work.

Can you give some more details of using client-side validation?

Talos

- Original Message - 
From: Antonio Petrelli [EMAIL PROTECTED]
To: Struts Users Mailing List user@struts.apache.org
Sent: Wednesday, March 26, 2008 4:56 PM
Subject: Re: How to enable the client side validation?


2008/3/26, Chen Chunwei [EMAIL PROTECTED]:

 My struts version is 1.1. And I tried to add html:javascript
 formName=submitForm / in my jsp file which needs validation. But it seems
 not working.



See:
http://struts.apache.org/1.1/userGuide/building_view.html#validator

Antonio


Re: How to enable the client side validation?

2008-03-26 Thread Chen Chunwei
Well, the case is that the Javascript code was generated well, but it was not 
triggered.

Talos

- Original Message - 
From: Antonio Petrelli [EMAIL PROTECTED]
To: Struts Users Mailing List user@struts.apache.org
Sent: Wednesday, March 26, 2008 5:10 PM
Subject: Re: How to enable the client side validation?


2008/3/26, Chen Chunwei [EMAIL PROTECTED]:

 As I said, I've already used html:javascript. Of course, I've alse done
 the other stuff found in the document you refer to (offline version). But it
 does not work.



What exactly does not work? Give more details, for example, exceptions at
startup of the application, or the Javascript code is not generated, etc.

Antonio


Re: How to enable the client side validation?

2008-03-26 Thread Antonio Petrelli
2008/3/26, Chen Chunwei [EMAIL PROTECTED]:

 Well, the case is that the Javascript code was generated well, but it was
 not triggered.



Well, that's strange. Can you post, the generated HTML and Javascript code?
What browser are you using? Changing browser changes anything?

Antonio


Re: How to enable the client side validation?

2008-03-26 Thread Antonio Petrelli
2008/3/26, Chen Chunwei [EMAIL PROTECTED]:

 As I said, I've already used html:javascript. Of course, I've alse done
 the other stuff found in the document you refer to (offline version). But it
 does not work.



What exactly does not work? Give more details, for example, exceptions at
startup of the application, or the Javascript code is not generated, etc.

Antonio


Re: How to enable the client side validation?

2008-03-26 Thread Chen Chunwei
I found the answer.

There's an attribute in html:javascript named method. You can specify a name 
in this attribute such as validateForm. Then specify the onsubmit event of the 
actual form with return validateForm(this);. After all, the javascript works.

The above solution comes from my colleague. But I wonder know is there any 
document refer to this? Or it should be a common sense?

Talos

- Original Message - 
From: Antonio Petrelli [EMAIL PROTECTED]
To: Struts Users Mailing List user@struts.apache.org
Sent: Wednesday, March 26, 2008 5:18 PM
Subject: Re: How to enable the client side validation?


2008/3/26, Chen Chunwei [EMAIL PROTECTED]:

 Well, the case is that the Javascript code was generated well, but it was
 not triggered.



Well, that's strange. Can you post, the generated HTML and Javascript code?
What browser are you using? Changing browser changes anything?

Antonio


Re: How to enable the client side validation?

2008-03-26 Thread Antonio Petrelli
2008/3/26, Chen Chunwei [EMAIL PROTECTED]:

 There's an attribute in html:javascript named method. You can specify a
 name in this attribute such as validateForm. Then specify the onsubmit event
 of the actual form with return validateForm(this);. After all, the
 javascript works.

 The above solution comes from my colleague. But I wonder know is there any
 document refer to this? Or it should be a common sense?



Good catch. In fact, I think that the docs should be fixed, because also in
the draft docs there is no reference about it:
http://struts.apache.org/1.x/userGuide/building_view.html#validator

So feel free to open an issue (and provide a patch, if you can :-) ):
https://issues.apache.org/struts/browse/STR

Antonio


Re: How to enable the client side validation?

2008-03-26 Thread Chen Chunwei
Sorry for mis-typing.

But I wonder know ...

should be 

But I wanna know...

Talos
- Original Message - 
From: Chen Chunwei [EMAIL PROTECTED]
To: Struts Users Mailing List user@struts.apache.org
Sent: Wednesday, March 26, 2008 5:34 PM
Subject: Re: How to enable the client side validation?


I found the answer.

There's an attribute in html:javascript named method. You can specify a name 
in this attribute such as validateForm. Then specify the onsubmit event of the 
actual form with return validateForm(this);. After all, the javascript works.

The above solution comes from my colleague. But I wonder know is there any 
document refer to this? Or it should be a common sense?

Talos

- Original Message - 
From: Antonio Petrelli [EMAIL PROTECTED]
To: Struts Users Mailing List user@struts.apache.org
Sent: Wednesday, March 26, 2008 5:18 PM
Subject: Re: How to enable the client side validation?


2008/3/26, Chen Chunwei [EMAIL PROTECTED]:

 Well, the case is that the Javascript code was generated well, but it was
 not triggered.



Well, that's strange. Can you post, the generated HTML and Javascript code?
What browser are you using? Changing browser changes anything?

Antonio