Re: client side validation in struts2

2011-02-15 Thread Chris Mawata
Try changing
%@ taglib prefix=s uri=/WEB-INF/struts-tags.tld %
to
%@ taglib prefix=s uri=/struts-tags %

Chris


On Tue, 2011-02-15 at 06:38 -0800, dasariprasad wrote:
 in clValid.jsp, i had used input page
 %@ taglib prefix=s uri=/WEB-INF/struts-tags.tld %
 html
  head
 titleStrut2's actions/title
s:head/
  /head
  body
   center
h1 Service Application/h1
   br/
   br/
s:form action=ClientValid validate=true namespace=/ 
 
 s:textfield name=applName  label=Applicant Name: /

 s:textfield name=charges label=Payable charges: /
   
   s:select label=Service Name: emptyOption=true
  list={'DrivingLicence','ElectricityBill',
  'WaterBill','InsurancePremium'} 
  name=service /   
   s:submit align=center value=show client-Side validation/
  /s:form
  /center
 /body
 /html 
 
  in struts.xml
 
 package name=htcstruts
 extends=struts-default
 
   action name=ClientValid
   class=htcstruts.ClientValidAction
 
 result name=success
   /clResult.jsp
 /result
 
 result name=input
/clValid.jsp
 /result
 
   /action
 action class is
 
 public class ClientValidAction extends ActionSupport {
  
   private String applName;
   private String service;
   private double charges;
   
   private String resStr;
 
   private ConcurrentHashMapString,Double services;
 
   public ClientValidAction() {
services = new ConcurrentHashMapString,Double();
services.put(DrivingLicence,new Double(100.5));
services.put(ElectricityBill,new Double(40.5));
services.put(WaterBill,new Double(35.5));
services.put(InsurancePremium,new Double(30.5));
   }
 
   public String execute() throws Exception {
double cost = services.get(service);
resStr = hello! +applName+ Charges for +
  service+  are +cost+.Please ready to pay;
return SUCCESS;
   }
 
   public String getResStr() {
return resStr;
   }
 
   public String getApplName() {
return applName;
   }
   
   public void setApplName(String newName) {
applName = newName;
   }
 
   public String getService() {
return service;
   }
   
   public void setService(String newService) {
 service = newService;
   }
 
   public double getCharges() {
return charges;
   }
   
   public void setCharges(double newCharge) {
 charges = newCharge;
   }
 }
 
 used a validator.xml ClientValidAction-validation.xml
 
!DOCTYPE validators PUBLIC
 
-//OpenSymphony Group//XWork Validator 1.0.2//EN
 
http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd;
 
   validators
 
field name=applName
 
   field-validator type=requiredstring
 
 true
 
 messageApplicant's name is required/message
 
   /field-validator
 
 /field
 
 field name=charges
 
  field-validator type=double
 
9.99
 
120.0
 
 message
  Charges should be higher than ${minExclusive} and lessequal to
 ${maxInclusive}
  
/message
 
   /field-validator
 
  /field
 
   /validators
  
 when i am asking the input , i am getting in browser
 
 FreeMarker template error!
 
 Method public java.util.List
 org.apache.struts2.components.Form.getValidators(java.lang.String) threw an
 exception when invoked on org.apache.struts2.components.Form@1be20c
 The problematic instruction:
 --
 == list tag.getValidators(${tagName}) as validator [on line 46, column 9
 in template/xhtml/form-close-validate.ftl]
  in include /${parameters.templateDir}/xhtml/form-close-validate.ftl [on
 line 25, column 1 in template/xhtml/form-close.ftl]
 --
 
 Java backtrace for programmers:
 --
 freemarker.template.TemplateModelException: Method public java.util.List
 org.apache.struts2.components.Form.getValidators(java.lang.String) threw an
 exception when invoked on org.apache.struts2.components.Form@1be20c
 at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:130)
 at freemarker.core.MethodCall._getAsTemplateModel(MethodCall.java:93)
 at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
 at freemarker.core.IteratorBlock.accept(IteratorBlock.java:94)
 at freemarker.core.Environment.visit(Environment.java:210)
 at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:167)
 at freemarker.core.Environment.visit(Environment.java:417)
 at freemarker.core.IteratorBlock.accept(IteratorBlock.java:102)
 at freemarker.core.Environment.visit(Environment.java:210)
 at freemarker.core.MixedContent.accept(MixedContent.java:92)
 at freemarker.core.Environment.visit(Environment.java:210)
 at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79)
 at freemarker.core.Environment.visit(Environment.java:210)
 at freemarker.core.MixedContent.accept(MixedContent.java:92)
 at freemarker.core.Environment.visit(Environment.java:210)
 at freemarker.core.Environment.include(Environment.java:1483)
 at freemarker.core.Include.accept(Include.java:169)
 at 

Re: Client Side Validation Not Working

2008-11-18 Thread Lukasz Lenart
And the server-side validation is working? I think not, name of xml is
not as it should be - it should be
CommentAction-save_comment-validation.xml


Regards
-- 
Lukasz
http://www.lenart.org.pl/

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



RE: Client Side Validation Not Working

2008-11-18 Thread Rabin Aryal
Lukasz,

Thanks a lot. I changed the action name and then what a silly
mistake...

Rabin 


-Original Message-
From: Lukasz Lenart [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, November 18, 2008 10:31 AM
To: Struts Users Mailing List
Subject: Re: Client Side Validation Not Working

And the server-side validation is working? I think not, name of xml is
not as it should be - it should be
CommentAction-save_comment-validation.xml


Regards
-- 
Lukasz
http://www.lenart.org.pl/

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



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



Re: Client Side Validation with Struts

2008-03-31 Thread Lukasz Lenart
  Hello. I am using Struts 1.3.8. The issue is not one of making the
  Javascript work (it is working correctly), but rather preventing a
  Struts action from being called. Is this possible given that the
  action of a form is a Struts action?

I'm not sure if I understand you, but all you have to do is return
true or false from your JavaScript function (as you doing), and that
will prevent a web browser to submit form and send them to a www
server. And if there be no request from web browser, there be no
action called.
Please copy/paste the web page content you had got when you started your form.


Regards
-- 
Lukasz

http://www.linkedin.com/in/lukaszlenart

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



Re: Client Side Validation with Struts

2008-03-29 Thread Lukasz Lenart
Hi,

Could you be more specific, which Struts version? If you use onsubmit
event, you should do that like this:

onsubmit=JavaScript: return validate();

where validate() has to return true or false.


Regards
-- 
Lukasz

http://www.linkedin.com/in/lukaszlenart

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



Re: Client Side Validation with Struts

2008-03-29 Thread Asad Habib
Hello. I am using Struts 1.3.8. The issue is not one of making the
Javascript work (it is working correctly), but rather preventing a
Struts action from being called. Is this possible given that the
action of a form is a Struts action?

- Asad



On Sat, Mar 29, 2008 at 6:44 AM, Lukasz Lenart
[EMAIL PROTECTED] wrote:
 Hi,

  Could you be more specific, which Struts version? If you use onsubmit
  event, you should do that like this:

  onsubmit=JavaScript: return validate();

  where validate() has to return true or false.


  Regards
  --
  Lukasz

  http://www.linkedin.com/in/lukaszlenart

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



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



Re: Client-side validation

2008-03-12 Thread Struts2SG

Hi ,

I wish that you can get some idea about this from the following link,

http://struts2issues.blogspot.com/

Struts2


Veronica Iturrioz wrote:
 
 I have a form with client side validation:
 
 s:form validate=true action=myAction namespace=/
 theme=xhtml
 
 and an Action with some annotated validations:
 
 @Validations(
 requiredStrings = {
 @RequiredStringValidator( message = Required, type =
 ValidatorType.FIELD,fieldName = name, trim =
 true, key=error.required)
 
 
 but I get an error because of the key property. If  I delete the key
 property, the client validation executes ok.
 In the package.properties I've the error.required key. 
 
 How can I do this? I want to execute client-validation with key messages. 
 
 I try to create a new theme, and replace form-close-validate.ftl :
 i replace the line:var error =
 ${validator.getMessage(action)?js_string};
 for:
 #if validator.defaultMessage?has_content
   var error = ${validator.defaultMessage?js_string};
  #else
  var error =
 ${action.getText(validator.getMessageKey())?js_string};
  /#if
 
 but the client validation is not executed.  Some themes do not support
 client-side validation. Only useful with theme xhtml/ajax
 
 thanks in advance.
 Veronica
 
 
 
 
 
 
 __
 Do You Yahoo!?
 Tired of spam?  Yahoo! Mail has the best spam protection around 
 http://mail.yahoo.com 
 

-- 
View this message in context: 
http://www.nabble.com/Client-side-validation-tp1003p16002045.html
Sent from the Struts - User mailing list archive at Nabble.com.


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



Re: Client-side validation

2008-03-12 Thread Dave Newton
--- Struts2SG [EMAIL PROTECTED] wrote:
 I wish that you can get some idea about this from the following link,
 
 http://struts2issues.blogspot.com/

If you're going to post other people's answers on your blog it would be
polite to properly attribute them. For example, I'm pretty sure It might
have been quicker to look up the JavaDocs was me.

I didn't see anything relating to the question being asked anyway.

Dave


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



RE: Client side validation for radio button

2007-10-12 Thread Mitch Claborn
In this case it is the xhtml theme.  (Isn't specified in the s:head tag but
using the default specified in struts.properties.)

  _  

Mitch Claborn
[EMAIL PROTECTED]



-Original Message-
From: Martin Gainty [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 11, 2000 5:52 PM
To: Struts Users Mailing List
Subject: Re: Client side validation for radio button


in your jsp head tag..
s:head theme=?/
what value have you assigned to theme?

M-
- Original Message -
From: Mitch Claborn [EMAIL PROTECTED]
To: 'Struts Users Mailing List' user@struts.apache.org
Sent: Thursday, October 11, 2007 5:38 PM
Subject: Client side validation for radio button


Using the xhtml theme, client-side validation for radio button is not
working.  I've tried both required and requiredstring but I suspect that
none will work.  The javascript code (from form-close-validation.ftl) does
this:


function validateForm_Question() {
form = document.getElementById(Question);

if (form.elements['q1']) {
field = form.elements['q1'];
var error = Please answer q1;
if (field.value == ) {
addError(field, error);
errors = true;
}
}

Which doesn't get the actual value of the selected radio.  I can code a
workaround in form-close-validation.ftl but it seems like this would have
been solved already?




Mitch Claborn
[EMAIL PROTECTED]



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



Re: Client side validation for radio button

2007-10-11 Thread Martin Gainty
in your jsp head tag..
s:head theme=?/
what value have you assigned to theme?

M-
- Original Message -
From: Mitch Claborn [EMAIL PROTECTED]
To: 'Struts Users Mailing List' user@struts.apache.org
Sent: Thursday, October 11, 2007 5:38 PM
Subject: Client side validation for radio button


Using the xhtml theme, client-side validation for radio button is not
working.  I've tried both required and requiredstring but I suspect that
none will work.  The javascript code (from form-close-validation.ftl) does
this:


function validateForm_Question() {
form = document.getElementById(Question);

if (form.elements['q1']) {
field = form.elements['q1'];
var error = Please answer q1;
if (field.value == ) {
addError(field, error);
errors = true;
}
}

Which doesn't get the actual value of the selected radio.  I can code a
workaround in form-close-validation.ftl but it seems like this would have
been solved already?




Mitch Claborn
[EMAIL PROTECTED]


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



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



Re: client side validation on included form

2007-02-22 Thread C. Adams

I have found a solution to this. The good news is it is a simple
pass-through to the dojo contentpane.

changing this:

s:div theme=ajax href=PersonByAge_input.action executeScripts=true /


to this:

div dojoType=ContentPane href=s:url action=PersonByAge_input
/   scriptSeparation=false executeScripts=true /div

fixes the issue. Could the developers add a passthrough to the dojo
scriptSeparation property?


On 2/21/07, C. Adams [EMAIL PROTECTED] wrote:


I have a form that I access via an action on an ajax-ish page. (Form and
results are on same page) It's working great, but I can't figure out the
validation.

The page looks like this now:

s:div theme=ajax href=PersonByAge_input.action executeScripts=true
/
s:div id=resultBox theme=ajax  /

with the form looking like this:

s:form action=PersonByAge theme=css_xhtml validate=true
Betweenbr/
s:textfield  name=startYear  label=Years labelposition=top  /
br clear=left/andbr/
s:textfield name=endYear label=Years labelposition=top /
br clear=left/
s:submit value=Find People theme=ajax targets=resultBox/
/s:form


With validation false, it works great.

With validation true, I get an error ReferenceError:
validateForm_PersonByAge is not defined and when I look in the generated
source, there are no javascript validation methods in the source.

but if I access the PersonByAge_input.action directly, the validation
methods are there in the source.

Have I hit a not quite ready area of the ajax theme?

Thanks.



Re: client side validation on included form

2007-02-22 Thread Musachy Barroso

Can you log a Jira ticket with the request?

thanks
musachy

On 2/22/07, C. Adams [EMAIL PROTECTED] wrote:


I have found a solution to this. The good news is it is a simple
pass-through to the dojo contentpane.

changing this:

s:div theme=ajax href=PersonByAge_input.action executeScripts=true
/


to this:

div dojoType=ContentPane href=s:url action=PersonByAge_input
/   scriptSeparation=false executeScripts=true /div

fixes the issue. Could the developers add a passthrough to the dojo
scriptSeparation property?


On 2/21/07, C. Adams [EMAIL PROTECTED] wrote:

 I have a form that I access via an action on an ajax-ish page. (Form and
 results are on same page) It's working great, but I can't figure out the
 validation.

 The page looks like this now:

 s:div theme=ajax href=PersonByAge_input.action
executeScripts=true
 /
 s:div id=resultBox theme=ajax  /

 with the form looking like this:

 s:form action=PersonByAge theme=css_xhtml validate=true
 Betweenbr/
 s:textfield  name=startYear  label=Years
labelposition=top  /
 br clear=left/andbr/
 s:textfield name=endYear label=Years labelposition=top /
 br clear=left/
 s:submit value=Find People theme=ajax targets=resultBox/
 /s:form


 With validation false, it works great.

 With validation true, I get an error ReferenceError:
 validateForm_PersonByAge is not defined and when I look in the
generated
 source, there are no javascript validation methods in the source.

 but if I access the PersonByAge_input.action directly, the validation
 methods are there in the source.

 Have I hit a not quite ready area of the ajax theme?

 Thanks.






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


Re: Client Side Validation

2006-08-03 Thread Irwan Nurwandi

Dear Chetan

Look at your bean form definition in your validation.xml

if you specify the form bean like this :

formset
form name=attendeeDetailsForm
   /form
/formset

then you should call generated javascript with this

html:javascript formName=attendeeDetailsForm/

the first letter in form bean name shouls be in lowercase also...

HTH
Irwan

On 8/3/06, Chetan Pandey [EMAIL PROTECTED] wrote:

Hi All:

This is what I am doing.

html:form action=/addAttendeeDetails onsubmit=return
validateAttendeeDetailsForm(this)
.
.
.
.
.
.
html:javascript formName=AttendeeDetailsForm/
/html:form


But the Code only does Server Side Validation.

Am I missing naything pls.

Thanks.

Chetan Pandey

-Original Message-
From: Romu [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 02, 2006 3:28 PM
To: Struts Users Mailing List
Subject: Re: Client Side Validation

your form shoud have been named :
attendeeDetailsForm, like bean no caps for first letter .

then
validateAttendeeDeta

 onsubmit=validateAttendeeDeta
 
  ilsForm ();

  or
validateAttendeeDeta

 onsubmit=validateAttendeeDeta
 
  ilsForm (this);
 

u can see the javascript generated in the source of your jsp btw .
hope it helps






2006/8/2, Chetan Pandey [EMAIL PROTECTED]:

 I have this:

 html:form action=/addAttendeeDetails  onsubmit=return
 validateRequired(this)

 Where validateRequired comes from the following Javascript code in my
 validator-rules.xml

 validator name=required
 classname=org.apache.struts.validator.FieldChecks
method=validateRequired
  methodParams=java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionMessages,
org.apache.commons.validator.Validator,
javax.servlet.http.HttpServletRequest
   msg=errors.required


 javascript![CDATA[
 function validateRequired(form) {
 
 }
   ]]
  /javascript
 /validator

 But no Client-side Validation is occuring

 -Original Message-
 From: Lixin Chu [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, August 02, 2006 10:35 AM
 To: Struts Users Mailing List
 Subject: Re: Client Side Validation

 do you have something like:
 onsubmit=validateAttendeeDetailsForm (this);
 in html:form ?

 and form name is not attendeeDetailsForn ?




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






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




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



RE: Client Side Validation

2006-08-03 Thread Chetan Pandey
I have changed the name to attendeeDetailsForm everywhere as you have
suggested

And have 
html:form action=/addAttendeeDetails onsubmit=return
 validateAttendeeDetailsForm(this)

But this is not helping me still.

I only get Server side validation, no Client Side Validation.

Thanks.

Chetan Pandey



-Original Message-
From: Irwan Nurwandi [mailto:[EMAIL PROTECTED] 
Sent: Thursday, August 03, 2006 2:13 PM
To: Struts Users Mailing List
Subject: Re: Client Side Validation

Dear Chetan

Look at your bean form definition in your validation.xml

if you specify the form bean like this :

formset
form name=attendeeDetailsForm
/form
/formset

then you should call generated javascript with this

html:javascript formName=attendeeDetailsForm/

the first letter in form bean name shouls be in lowercase also...

HTH
Irwan

On 8/3/06, Chetan Pandey [EMAIL PROTECTED] wrote:
 Hi All:

 This is what I am doing.

 html:form action=/addAttendeeDetails onsubmit=return
 validateAttendeeDetailsForm(this)
 .
 .
 .
 .
 .
 .
 html:javascript formName=AttendeeDetailsForm/
 /html:form


 But the Code only does Server Side Validation.

 Am I missing naything pls.

 Thanks.

 Chetan Pandey

 -Original Message-
 From: Romu [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, August 02, 2006 3:28 PM
 To: Struts Users Mailing List
 Subject: Re: Client Side Validation

 your form shoud have been named :
 attendeeDetailsForm, like bean no caps for first letter .

 then
 validateAttendeeDeta
 
  onsubmit=validateAttendeeDeta
  
   ilsForm ();
 
   or
 validateAttendeeDeta
 
  onsubmit=validateAttendeeDeta
  
   ilsForm (this);
  
 
 u can see the javascript generated in the source of your jsp btw .
 hope it helps






 2006/8/2, Chetan Pandey [EMAIL PROTECTED]:
 
  I have this:
 
  html:form action=/addAttendeeDetails  onsubmit=return
  validateRequired(this)
 
  Where validateRequired comes from the following Javascript code in my
  validator-rules.xml
 
  validator name=required
  classname=org.apache.struts.validator.FieldChecks
 method=validateRequired
   methodParams=java.lang.Object,
 org.apache.commons.validator.ValidatorAction,
 org.apache.commons.validator.Field,
 org.apache.struts.action.ActionMessages,
 org.apache.commons.validator.Validator,
 javax.servlet.http.HttpServletRequest
msg=errors.required
 
 
  javascript![CDATA[
  function validateRequired(form) {
  
  }
]]
   /javascript
  /validator
 
  But no Client-side Validation is occuring
 
  -Original Message-
  From: Lixin Chu [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, August 02, 2006 10:35 AM
  To: Struts Users Mailing List
  Subject: Re: Client Side Validation
 
  do you have something like:
  onsubmit=validateAttendeeDetailsForm (this);
  in html:form ?
 
  and form name is not attendeeDetailsForn ?
 
 
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 




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



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





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



Re: Client Side Validation

2006-08-02 Thread Romu

your form shoud have been named :
attendeeDetailsForm, like bean no caps for first letter .

then
validateAttendeeDeta


onsubmit=validateAttendeeDeta

 ilsForm ();

 or

validateAttendeeDeta


onsubmit=validateAttendeeDeta

 ilsForm (this);



u can see the javascript generated in the source of your jsp btw .
hope it helps






2006/8/2, Chetan Pandey [EMAIL PROTECTED]:


I have this:

html:form action=/addAttendeeDetails  onsubmit=return
validateRequired(this)

Where validateRequired comes from the following Javascript code in my
validator-rules.xml

validator name=required
classname=org.apache.struts.validator.FieldChecks
   method=validateRequired
 methodParams=java.lang.Object,
   org.apache.commons.validator.ValidatorAction,
   org.apache.commons.validator.Field,
   org.apache.struts.action.ActionMessages,
   org.apache.commons.validator.Validator,
   javax.servlet.http.HttpServletRequest
  msg=errors.required


javascript![CDATA[
function validateRequired(form) {

}
  ]]
 /javascript
/validator

But no Client-side Validation is occuring

-Original Message-
From: Lixin Chu [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 02, 2006 10:35 AM
To: Struts Users Mailing List
Subject: Re: Client Side Validation

do you have something like:
onsubmit=validateAttendeeDetailsForm (this);
in html:form ?

and form name is not attendeeDetailsForn ?




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




RE: Client Side Validation

2006-08-02 Thread Chetan Pandey
Hi All:

This is what I am doing.

html:form action=/addAttendeeDetails onsubmit=return
validateAttendeeDetailsForm(this)
.
.
.
.
.
.
html:javascript formName=AttendeeDetailsForm/
/html:form


But the Code only does Server Side Validation.

Am I missing naything pls.

Thanks.

Chetan Pandey

-Original Message-
From: Romu [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 02, 2006 3:28 PM
To: Struts Users Mailing List
Subject: Re: Client Side Validation

your form shoud have been named :
attendeeDetailsForm, like bean no caps for first letter .

then
validateAttendeeDeta

 onsubmit=validateAttendeeDeta
 
  ilsForm ();

  or
validateAttendeeDeta

 onsubmit=validateAttendeeDeta
 
  ilsForm (this);
 

u can see the javascript generated in the source of your jsp btw .
hope it helps






2006/8/2, Chetan Pandey [EMAIL PROTECTED]:

 I have this:

 html:form action=/addAttendeeDetails  onsubmit=return
 validateRequired(this)

 Where validateRequired comes from the following Javascript code in my
 validator-rules.xml

 validator name=required
 classname=org.apache.struts.validator.FieldChecks
method=validateRequired
  methodParams=java.lang.Object,
org.apache.commons.validator.ValidatorAction,
org.apache.commons.validator.Field,
org.apache.struts.action.ActionMessages,
org.apache.commons.validator.Validator,
javax.servlet.http.HttpServletRequest
   msg=errors.required


 javascript![CDATA[
 function validateRequired(form) {
 
 }
   ]]
  /javascript
 /validator

 But no Client-side Validation is occuring

 -Original Message-
 From: Lixin Chu [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, August 02, 2006 10:35 AM
 To: Struts Users Mailing List
 Subject: Re: Client Side Validation

 do you have something like:
 onsubmit=validateAttendeeDetailsForm (this);
 in html:form ?

 and form name is not attendeeDetailsForn ?




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






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



Re: Client Side Validation

2006-08-01 Thread Lixin Chu

do you have something like:
onsubmit=validateAttendeeDetailsForm (this);
in html:form ?

and form name is not attendeeDetailsForn ?


RE: Client Side Validation

2006-08-01 Thread Chetan Pandey
I have this:

html:form action=/addAttendeeDetails  onsubmit=return
validateRequired(this)

Where validateRequired comes from the following Javascript code in my
validator-rules.xml

validator name=required
classname=org.apache.struts.validator.FieldChecks
   method=validateRequired
 methodParams=java.lang.Object,
   org.apache.commons.validator.ValidatorAction,
   org.apache.commons.validator.Field,
   org.apache.struts.action.ActionMessages,
   org.apache.commons.validator.Validator,
   javax.servlet.http.HttpServletRequest
  msg=errors.required


javascript![CDATA[
function validateRequired(form) {

}
  ]]
 /javascript   
/validator

But no Client-side Validation is occuring

-Original Message-
From: Lixin Chu [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 02, 2006 10:35 AM
To: Struts Users Mailing List
Subject: Re: Client Side Validation

do you have something like:
 onsubmit=validateAttendeeDetailsForm (this);
in html:form ?

and form name is not attendeeDetailsForn ?




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



Re: Client Side Validation

2006-03-21 Thread Ted Husted
The MailReader application for 1.3 uses DynaValidatorForm's. You could
change those to
DynaValidatorActionForm to test the syntax changes.

* http://svn.apache.org/dist/struts/apps/v1.3.0/

HTH, Ted.


On 3/21/06, Vinny [EMAIL PROTECTED] wrote:
 Anyone have an example of using client
 side validation with a DynaValidatorActionForm ?

 I see no examples in here
 http://struts.apache.org//struts-doc-1.2.8/userGuide/dev_validator.html
 and while the javascript tag descrption is thorough:
 (http://struts.apache.org//struts-doc-1.2.8/userGuide/struts-html.html#javascript)
 I find it  sort of useless outside of context.

 I am using the path attribute as the key in my validation.xml
 The form associated with the action is a DynaValidatorActionForm.


 html:form action = /FooLookupAction onsubmit=return
 validatefooLookupAction(this)

 // stuff here

 /html:form
 html:javascript formName=LookupAction /

 now I realize this syntax must be very wrong because I'm getting:
 ServletException:  No form found under 'FooLookupAction' in locale 'en_US'

 I know that it is  done one way if you use a normal ActionForm for and
 another way
 for  DynaValidator* . I'm  piuzzled as to why usage examples on the
 various permutations
 of client side validation have not yet slipped into the docs after all
 these years.

 Thanks in advance.
 Vinny

 --
 Ghetto Java: http://www.ghettojava.com

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




--
HTH, Ted.
** http://www.husted.com/ted/blog/

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



Re: Client Side Validation

2006-03-21 Thread Laurie Harper
Also, you'll need to move the html:javascript tag inside the html:form 
tag. The reason you're getting an error looking up the form bean is 
because it only exists within the scope of html:form tag. Note that this 
requirement is generally true for form-based tag in the html taglib.


L.

Ted Husted wrote:

The MailReader application for 1.3 uses DynaValidatorForm's. You could
change those to
DynaValidatorActionForm to test the syntax changes.

* http://svn.apache.org/dist/struts/apps/v1.3.0/

HTH, Ted.


On 3/21/06, Vinny [EMAIL PROTECTED] wrote:

Anyone have an example of using client
side validation with a DynaValidatorActionForm ?

I see no examples in here
http://struts.apache.org//struts-doc-1.2.8/userGuide/dev_validator.html
and while the javascript tag descrption is thorough:
(http://struts.apache.org//struts-doc-1.2.8/userGuide/struts-html.html#javascript)
I find it  sort of useless outside of context.

I am using the path attribute as the key in my validation.xml
The form associated with the action is a DynaValidatorActionForm.


html:form action = /FooLookupAction onsubmit=return
validatefooLookupAction(this)

// stuff here

/html:form
html:javascript formName=LookupAction /

now I realize this syntax must be very wrong because I'm getting:
ServletException:  No form found under 'FooLookupAction' in locale 'en_US'

I know that it is  done one way if you use a normal ActionForm for and
another way
for  DynaValidator* . I'm  piuzzled as to why usage examples on the
various permutations
of client side validation have not yet slipped into the docs after all
these years.

Thanks in advance.
Vinny

--
Ghetto Java: http://www.ghettojava.com

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





--
HTH, Ted.
** http://www.husted.com/ted/blog/



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



RE: Client side validation broken when using DynaValidatorActionForm.

2004-11-26 Thread Daffin, Miles (Company IT)
David,

Many thanks.

-Miles 

 -Original Message-
 From: David G. Friedman [mailto:[EMAIL PROTECTED] 
 Sent: 25 November 2004 17:49
 To: Struts Users Mailing List
 Subject: RE: Client side validation broken when using 
 DynaValidatorActionForm.
 
 Miles,
 
 Validation based on actions has that slash-in-the-name 
 related problem.  You can specify a name for the validation 
 method using the html:javascript attribute method=  
 Just be sure to change your html:form's onsubmit to invoke 
 that new method name.  For example:
 
 html:javascript formName=/someActionName 
 method=validateForm / html:form action=... ... 
 onsubmit=return(validateForm(this));
 
 Just use the name validateForm or change it to any valid 
 JavaScript method name of your choice.  For more details see:
 
 http://forum.java.sun.com/thread.jspa?forumID=45messageID=267
 4439threadID=
 548445
 http://homepage2.nifty.com/ymagic/struts/OtherTranslate/Struts
 Validator/jspt
 ags-jp.html
 
 Regards,
 David
 
 -Original Message-
 From: Daffin, Miles (Company IT) 
 [mailto:[EMAIL PROTECTED]
 Sent: Thursday, November 25, 2004 11:38 AM
 To: Struts Users Mailing List
 Subject: Client side validation broken when using 
 DynaValidatorActionForm.
 
 
 Hi All,
 
 Apologies if this one has already been covered (I searched the list).
 
 I am using struts 1.1 with one DynaValidatorActionForm for 
 holding data from multiple jsp forms (wizard style reg form).
 
 The server side validation works fine but the generated 
 javascript is broken. The name of the form validating 
 function is taken directly from the form name attribute in 
 the form-validation formset (validation.xml), and this 
 contains '/' characters because it is the path to the relevant action.
 
 Is this a bug, or am I misusing/misunderstanding something?
 
 Thanks.
 
 -Miles
 
 Miles Daffin
 Morgan Stanley
 20 Cabot Square | Canary Wharf | London E14 4QA | UK
 Tel: +44 (0) 20 767 75119
 [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
 
 
 NOTICE: If received in error, please destroy and notify 
 sender.  Sender does not waive confidentiality or privilege, 
 and use is prohibited.
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 

 
NOTICE: If received in error, please destroy and notify sender.  Sender does 
not waive confidentiality or privilege, and use is prohibited. 
 

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



RE: Client side validation broken when using DynaValidatorActionForm.

2004-11-25 Thread David G. Friedman
Miles,

Validation based on actions has that slash-in-the-name related problem.  You
can specify a name for the validation method using the html:javascript
attribute method=  Just be sure to change your html:form's onsubmit to
invoke that new method name.  For example:

html:javascript formName=/someActionName method=validateForm /
html:form action=... ... onsubmit=return(validateForm(this));

Just use the name validateForm or change it to any valid JavaScript method
name of your choice.  For more details see:

http://forum.java.sun.com/thread.jspa?forumID=45messageID=2674439threadID=
548445
http://homepage2.nifty.com/ymagic/struts/OtherTranslate/StrutsValidator/jspt
ags-jp.html

Regards,
David

-Original Message-
From: Daffin, Miles (Company IT) [mailto:[EMAIL PROTECTED]
Sent: Thursday, November 25, 2004 11:38 AM
To: Struts Users Mailing List
Subject: Client side validation broken when using
DynaValidatorActionForm.


Hi All,

Apologies if this one has already been covered (I searched the list).

I am using struts 1.1 with one DynaValidatorActionForm for holding data
from multiple jsp forms (wizard style reg form).

The server side validation works fine but the generated javascript is
broken. The name of the form validating function is taken directly from
the form name attribute in the form-validation formset (validation.xml),
and this contains '/' characters because it is the path to the relevant
action.

Is this a bug, or am I misusing/misunderstanding something?

Thanks.

-Miles

Miles Daffin
Morgan Stanley
20 Cabot Square | Canary Wharf | London E14 4QA | UK
Tel: +44 (0) 20 767 75119
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED]


NOTICE: If received in error, please destroy and notify sender.  Sender does
not waive confidentiality or privilege, and use is prohibited.



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



Re: client-side validation javascript error

2004-10-26 Thread Niall Pemberton
Version 1.2.2 of Struts was withdrawn because of problems. The current ga
quality release of Struts is Version 1.2.4

http://struts.apache.org/acquiring.html

Niall

- Original Message - 
From: Jeffrey Ford [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, October 26, 2004 5:52 PM
Subject: client-side validation javascript error


 Hi,

 I'm trying to get client-side validation to work using Struts, v. 1.2.2.
 More specifically, I'm receiving a javascript error while trying to use
the
 'required' validation rule.  The error in IE says:

 Error: 'required' is undefined

 When I look at the generated javascript, this is indeed true.  However,
 there's a function called 'locationForm_required' where 'locationForm' is
 the name of my form.  It seems that the 'validateRequired' method should
be
 calling a 'new locationForm_required( )' instead of a 'new required( ).

 function locationForm_required () {
  this.a0 = new Array(shortDescription, Short Description is
 required., new Function (varName,  return this[varName];));
 }

 function validateRequired(form) {
 var isValid = true;
 var focusField = null;
 var i = 0;
 var fields = new Array();
 oRequired = new required();
 for (x in oRequired) {
 var field = form[oRequired[x][0]];
 ... blah blah


 Does anyone have any insight into this?

 Thanks in advance,
 Jeff




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






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



RE: Client Side Validation using a pure JSF Only Application

2004-09-29 Thread Prasad, Kamakshya
Hi,

Download the sources from this site
http://horstmann.com/corejsf/

In ch12 you can find examples for generating the client side javascript
code for performing the client side validations.

Regards,
KP

-Original Message-
From: babloosony [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 29, 2004 3:27 PM
To: Struts Users Mailing List; [EMAIL PROTECTED]
Subject: Client Side Validation using a pure JSF Only Application

Hi All,

There is a pure web application that uses only jsf as model, view,
controller. How do we achieve a reusable client-side validations
framework likes Struts's validator framework ?

Any ideas on how we do a clientside validation in a pure jsf application
?


Thanks  Regards,
Kumar.

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


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



Re: Client Side Validation using a pure JSF Only Application

2004-09-29 Thread Duncan Mills
Check out the Oracle Faces components set which you can get an Early 
Access version of from:
http://www.oracle.com/technology/products/jdev/htdocs/partners/addins/exchange/jsf/index.html
This implemenation has client side validators built-in

Regards
Duncan Mills

babloosony wrote:
Hi All,
There is a pure web application that uses only jsf as model, view,
controller. How do we achieve a reusable client-side validations
framework likes Struts's validator framework ?
Any ideas on how we do a clientside validation in a pure jsf application ?
Thanks  Regards,
Kumar.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 

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


Re: client side validation using struts in a jsf+struts integrated application

2004-09-26 Thread Craig McClanahan
On Fri, 24 Sep 2004 11:38:56 +0530, babloosony [EMAIL PROTECTED] wrote:
 Hi All,
 
 How do I do client side validation(using struts) in jsf+struts
 integrated application which uses jsf-struts libary provided by
 CraigMc. ?

You enable client side validation with Struts+JSF the same way you do
in a standalone Struts based application -- by adding an onsubmit
hander to the form tag, and an appropriate JavaScript tag to include
the actual validation methods.

Both of the examples included with the Struts+JSF library have client
side JavaScript enabled.

 
 Thanks  Regards,
 Kumar.

Craig

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