You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by goelshek <go...@yahoo.com> on 2008/04/10 16:38:50 UTC

Struts 2.0: Ajax based client side validation "onblur"

For Struts 2.0 (NOT 2.1):

The documentation for introduction to 
http://struts.apache.org/2.0.11.1/docs/ajax-client-side-validation.html Ajax
Client Side Validation  says that "The validation occurs on each onblur
event for each form element". The 
http://struts.apache.org/2.0.11.1/docs/ajax-validation.html example   starts
off by saying that "An example is provided on how to use AJAX validation
with Prototype, in this case the Dojo plugin is not required." So I scroll
down to the bottom of the page and try to follow the Example using
Prototype. However, there are two issues I see with this example. 

Firstly, there is no onblur specified for each element. So does this example
really work for onblur? 

Secondly, even if I assume that the code for onblur will be put at runtime,
when implementing the said example, my browser tells me that it could not
find "Ajax" which is probably an object in prototype.js. Apparently the src
in the two script declarations: 

1) <script language="JavaScript"
src="${pageContext.request.contextPath}/struts/utils.js"
type="text/javascript"></script> 

AND 

2) <script src="${pageContext.request.contextPath}/js/prototype.js"
type="text/javascript"></script> 

cannot be resolved. From all my searching, there has been no clue as to
where I can find these .js files. People say that they are "automagically"
put there. But even for that magic to happen, those files must be present in
the source code of struts. I searched through the entire source code and it
just does not have either of those two files. 

To conclude, I am trying to get Ajax based client side validation to work
onblur at each element (NOT onsubmit of the form; that works fine). But
there seems to be no example - not even in the showcase tutorial. If anyone
has got it to work, I would really appreciate if you could share your
example with me. 

Thanks. 

PS: In many places in the documentation I see notifications to the effect:
"This documentation refers to version 2.1 which has not been released yet."
Isn't that kind of ridiculous? Providing documentation for something that
isn't even released is something I cannot wrap my head around. If someone
can explain that concept to a novice user like myself, it would be a great
help.
-- 
View this message in context: http://www.nabble.com/Struts-2.0%3A-Ajax-based-client-side-validation-%22onblur%22-tp16608849p16608849.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts 2.0: Ajax based client side validation "onblur"

Posted by Musachy Barroso <mu...@gmail.com>.
The page that you are refering to is for 2.1, as stated on the top of
the page. The reason why the documentation is all mixed together wit
"2.1" warnings on some pages is because we don't have branches on the
wiki (or separate wikis) for different versions, as I mentioned on
another thread.

regards
musachy

On Thu, Apr 10, 2008 at 2:38 PM, goelshek <go...@yahoo.com> wrote:
>
>  For Struts 2.0 (NOT 2.1):
>
>  The documentation for introduction to
>  http://struts.apache.org/2.0.11.1/docs/ajax-client-side-validation.html Ajax
>  Client Side Validation  says that "The validation occurs on each onblur
>  event for each form element". The
>  http://struts.apache.org/2.0.11.1/docs/ajax-validation.html example   starts
>  off by saying that "An example is provided on how to use AJAX validation
>  with Prototype, in this case the Dojo plugin is not required." So I scroll
>  down to the bottom of the page and try to follow the Example using
>  Prototype. However, there are two issues I see with this example.
>
>  Firstly, there is no onblur specified for each element. So does this example
>  really work for onblur?
>
>  Secondly, even if I assume that the code for onblur will be put at runtime,
>  when implementing the said example, my browser tells me that it could not
>  find "Ajax" which is probably an object in prototype.js. Apparently the src
>  in the two script declarations:
>
>  1) <script language="JavaScript"
>  src="${pageContext.request.contextPath}/struts/utils.js"
>  type="text/javascript"></script>
>
>  AND
>
>  2) <script src="${pageContext.request.contextPath}/js/prototype.js"
>  type="text/javascript"></script>
>
>  cannot be resolved. From all my searching, there has been no clue as to
>  where I can find these .js files. People say that they are "automagically"
>  put there. But even for that magic to happen, those files must be present in
>  the source code of struts. I searched through the entire source code and it
>  just does not have either of those two files.
>
>  To conclude, I am trying to get Ajax based client side validation to work
>  onblur at each element (NOT onsubmit of the form; that works fine). But
>  there seems to be no example - not even in the showcase tutorial. If anyone
>  has got it to work, I would really appreciate if you could share your
>  example with me.
>
>  Thanks.
>
>  PS: In many places in the documentation I see notifications to the effect:
>  "This documentation refers to version 2.1 which has not been released yet."
>  Isn't that kind of ridiculous? Providing documentation for something that
>  isn't even released is something I cannot wrap my head around. If someone
>  can explain that concept to a novice user like myself, it would be a great
>  help.
>  --
>  View this message in context: http://www.nabble.com/Struts-2.0%3A-Ajax-based-client-side-validation-%22onblur%22-tp16608849p16608849.html
>  Sent from the Struts - User mailing list archive at Nabble.com.
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>  For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org