[struts2-jquery] jquery client side validation ????

300 views
Skip to first unread message

omaya

unread,
Apr 19, 2010, 6:26:43 AM4/19/10
to struts2-jquery
HI,PLZ How can I make the client side control fields with Struts 2 -
jquery1.2 for the following jsp code:

<s:form action="addSA" validate="true" theme="xhtml">
<s:textfield label="Name" onChangeTopics="textfieldUpdated"
name="name" />
<s:submit value="addForm"/>
</s:form>

the function validate="true" doesn't give any effect so i want to
replace it with the apropriate javascript validation code (used in
jquery).

Thanks for your help

Best regards

--
You received this message because you are subscribed to the Google Groups "struts2-jquery" group.
To post to this group, send email to struts2...@googlegroups.com.
To unsubscribe from this group, send email to struts2-jquer...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/struts2-jquery?hl=en.

Manuel T

unread,
Apr 19, 2010, 6:29:59 AM4/19/10
to struts2-jquery
On Apr 19, 12:26 pm, omaya <zakha.il...@gmail.com> wrote:
> HI,PLZ How can I make the client side control fields with Struts 2 -
> jquery1.2 for the following jsp code:
>
> <s:form action="addSA" validate="true"  theme="xhtml">
> <s:textfield label="Name" onChangeTopics="textfieldUpdated"
> name="name"  />
> <s:submit value="addForm"/>
> </s:form>
>
> the function validate="true" doesn't give any effect so i want to
> replace it with the apropriate  javascript validation code (used in
> jquery).

The question is unrelated to struts2-jquery plugin. It's bound to
Struts 2 client side validation. I suggest you to read the following:

http://struts.apache.org/2.1.8/docs/validation.html

omaya

unread,
Apr 19, 2010, 6:37:11 AM4/19/10
to struts2-jquery
Thank you for your response, but the validation (in struts 2 client
side) work with the <s:textfield> and it dosn't work with
<sj:textfield> used in jquery.

Best regards

jogep

unread,
Apr 19, 2010, 7:10:52 AM4/19/10
to struts2-jquery
Hello,

have you included the JavaScript resources they comes with struts2 in
your head area?

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

You need this when you like to validate forms with xhtml theme.

Why you use Struts2 jQuery 1.2?
Current Version with Client Validation Support is 2.0.0 !

http://code.google.com/p/struts2-jquery/downloads/list

Best Regards

Johannes Geppert

---
web: http://www.jgeppert.com
twitter: http://twitter.com/jogep

omaya

unread,
Apr 19, 2010, 7:20:09 AM4/19/10
to struts2-jquery
I'm using Struts2 jQuery 1.2 because the property onChangeTopic of
textfield (if you remember that) doesn't work for me, and i didn't
have enough time to search more, so i used this version of jquery
because i need it in the project on which i'm working now.

Thanks

Best regards

jogep

unread,
Apr 19, 2010, 7:27:11 AM4/19/10
to struts2-jquery
Sorry but this User Group is not the right point for your plugin.

you can try the current snapshot version of this plugin,
with this the onChangeTopic works also for textfields.

You can get it here.
http://oss.sonatype.org/content/repositories/snapshots/com/jgeppert/struts2/jquery/

Best Regards

Johannes Geppert

---
web: http://www.jgeppert.com
twitter: http://twitter.com/jogep

omaya

unread,
Apr 19, 2010, 10:56:26 AM4/19/10
to struts2-jquery
Thank you, so plz where can i find the example of onChangeTopic for
textfield if i want to migrate to jquery 2.0.

Best regards

On 19 avr, 13:27, jogep <joh...@googlemail.com> wrote:
> Sorry but this User Group is not the right point for your plugin.
>
> you can try the current snapshot version of this plugin,
> with this the onChangeTopic works also for textfields.
>
> You can get it here.http://oss.sonatype.org/content/repositories/snapshots/com/jgeppert/s...

omaya

unread,
Apr 19, 2010, 12:15:22 PM4/19/10
to struts2-jquery
Hi,

is that the version 1.8.3 of jquery support the client side validation
and the onChaneTopics of textfield??

so don't forget plz to give me the example of onChaneTopics in version
2.0 or 1.8.3.

Thank you for your support
Best regards

jogep

unread,
Apr 20, 2010, 1:52:08 AM4/20/10
to struts2-jquery
Hello,

for the onChangeTopics you need the version 2.1.0
from the SNAPSHOT repository that i posted yesterday.
This version goes final in the next days.

following code works fine for me:
<s:form id="formwithOnchangeTopics" action="simpleecho"
theme="simple">
<label for="echo">Echo: </label>
<sj:textarea
id="echo"
name="echo"
rows="4"
cols="80"
onChangeTopics="submitThisForm"
/>
<sj:submit
targets="result"
value="AJAX Submit"
button="true"
listenTopics="submitThisForm"
/>
</s:form>

<div id="result">Enter some text in the textarea bellow.</div>

This sample should also work with an textfield.

Best Regards

Johannes Geppert

omaya

unread,
Apr 20, 2010, 5:39:33 AM4/20/10
to struts2-jquery
Thank you very mutch for your support, i will test it.

Best regards
Reply all
Reply to author
Forward
0 new messages