Validation and Reset

2003-03-21 Thread Weber, Jeremy
Hello all!

It seems when I click my reset button my form is validated.  Is there anyway
to keep this from happening?
I am using  and the reset methodology here
http://www.husted.com/struts/tips/001.html


Jeremy Weber
Eventra, Inc.   
Sr. SCM Specialist
203-882-9988 x2631
[EMAIL PROTECTED]

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



Default Value Question

2003-03-20 Thread Weber, Jeremy
>From the below code, I know that the gid() method gets called because the
System.out line executes, however the ownerGroup string never gets set.  Am
I doing something wrong?


import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.*;
import java.io.File;
import org.apache.struts.validator.ValidatorForm;
import java.io.Serializable;
import java.lang.System;
import com.install.util.GetGid;

public final class MyFormBean extends ValidatorForm implements Serializable
{

private String ownerGroup = gid();


public String getOwnerGroup() {
return (this.ownerGroup);
}

public void setOwnerGroup(String ownerGroup){
this.ownerGroup = ownerGroup;
}


public String gid() {
System.out.println("Should be returning GID: " +
GetGid.getGid());
return GetGid.getGid();
}
}


Thanks,


Jeremy Weber
[EMAIL PROTECTED]

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



Checked/Radio Button

2003-02-04 Thread Weber, Jeremy
How does one specify that a radio button should be checked?  The 

If I have 


or


Struts throws an exception because it isnt listed in
org.apache.struts.taglib.html.RadioTag.

Thanks,


Jeremy Weber
[EMAIL PROTECTED]

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




Help with Form Logic...

2003-01-31 Thread Weber, Jeremy
Hi,

Hopefully someone can give me idea about how to code the following logic for
an Html Form.

Based on a prior users responses i want to create a form that includes
anywhere from 4 to 40 fields.  I have the users response in a int called
installBase. 
For each installBase ( possible values range from 1 to 10) I want to show
four fields, each with 2 radio buttons.

For instance...

int installBase=2

Install 1
Field 1 True and False radio buttons.
Field 2 True and False radio buttons.
Field 3 True and False radio buttons.
Field 4 True and False radio buttons.

I cant seem to figure out the best way to do this.  Especially when dealing
with the field property names.  It seems I cant use something like this.

for (int x=0; x < installBase; x++){
realInstance=x+1;
out.println("Field " + realInstance);
out.println("");
out.println("");
}

Doing so, results in the html:radio field, not being interpreted.  It doesnt
seem like I could use property="<% =something %>" either...

Any thoughts, becuase I know there has to be any easier way, I am
overlooking...


Thanks!









Jeremy Weber
[EMAIL PROTECTED]

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




RE: [VALIDATOR] requiredif ??

2003-01-31 Thread Weber, Jeremy
I had a ton of problems with required if.  I finally just ripped it out and
made my own based on it.  In the code I am using, (I am unsure its b2/b3 or
a tip build at this point) I dont see a NOTEQUAL comparison

Heres what I am using  See inline comments for explanation. 


public final static String FIELD_TEST_NULL = "NULL";
public final static String FIELD_TEST_NOTNULL = "NOTNULL";
public final static String FIELD_TEST_EQUAL = "EQUAL";


public static boolean validateJSWRequiredIf(Object bean,
 ValidatorAction va, Field
field,
 ActionErrors errors,

org.apache.commons.validator.Validator validator,
 HttpServletRequest request) {

Object form =
validator.getResource(org.apache.commons.validator.Validator.BEAN_KEY);

boolean required = false;
String value=null;

System.out.println("PROPERTY: " + field.getProperty());

if (isString(bean)) {
value = (String) bean;
} else {
value = ValidatorUtil.getValueAsString(bean,
field.getProperty());

}

System.out.println("VALUE from VsValidate: " +  value);

int i = 0;
String fieldJoin = "AND";
if
(!GenericValidator.isBlankOrNull(field.getVarValue("field-join"))) {
fieldJoin = field.getVarValue("field-join");
}
if (fieldJoin.equalsIgnoreCase("AND")) {
required = true;
}
while (!GenericValidator.isBlankOrNull(field.getVarValue("field[" +
i + "]"))) {
String dependProp = field.getVarValue("field[" + i + "]");
String dependTest = field.getVarValue("field-test[" + i + "]");
String dependTestValue = field.getVarValue("field-value[" + i +
"]");
String dependIndexed = field.getVarValue("field-indexed[" + i +
"]");

System.out.println("DEPEND PROP: " + dependProp);
System.out.println("DEPEND Test: " + dependTest);
System.out.println("DEPEND TEST VALUE: " + dependTestValue);


if (dependIndexed == null)
dependIndexed = "false";
String dependVal = null;
boolean this_required = false;
if (field.isIndexed() && dependIndexed.equalsIgnoreCase("true"))
{
String key = field.getKey();
if ((key.indexOf("[") > -1) &&
 (key.indexOf("]") > -1)) {
String ind = key.substring(0, key.indexOf(".") + 1);
dependProp = ind + dependProp;
}
}
dependVal = ValidatorUtil.getValueAsString(form, dependProp);
if (dependTest.equals(FIELD_TEST_NULL)) {
if ((dependVal != null) && (dependVal.length() > 0)) {
this_required = false;
} else {
this_required = true;
}
}
if (dependTest.equals(FIELD_TEST_NOTNULL)) {
if ((dependVal != null) && (dependVal.length() > 0)) {
this_required = true;
} else {
this_required = false;
}
}
if (dependTest.equals(FIELD_TEST_EQUAL)) {

this_required = dependTestValue.equalsIgnoreCase(dependVal);

//HAD TO ADD THIS TO DO AN EQUALS COMPARISON
String dependPropValue =
ValidatorUtil.getValueAsString(bean, dependProp);
if ( ! dependTestValue.equals( dependPropValue ) ){
   System.out.println("print here---");
   return false;
}
//END ADDTION
}


if (fieldJoin.equalsIgnoreCase("AND")) {
required = required && this_required;
} else {
required = required || this_required;
}
i++;
}
if (required) {
if ((value != null) && (value.length() > 0)) {
return true;
} else {
//errors.add(field.getKey(),
Resources.getActionError(request, va, field));

errors.add(field.getKey(),StrutsValidatorUtil.getActionError(request,va,fiel
d));
return false;
}
}
return true;
}


Jeremy Weber
[EMAIL PROTECTED]


-Original Message-
From: Wendy Smoak [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 30, 2003 12:41 PM
To: 'Struts Users Mailing List'
Subject: RE: [VALIDATOR] requiredif ??



I'm Still struggling with requiredif... there doesn't seem to be a working
example of it included with 1.1b3.  I've gone through the documentation and
come up with this.  I'm trying to say that address is required only if
  1. prospect is null
  2. prospectNameOrId is not null

Where to send bugs/fixes (RequiredIf Equals Condition)

2003-01-27 Thread Weber, Jeremy
Where should I send bugs or fixes with common validator.  Specifically the
EQUAL condition in RequiredIf doesnt seem to do anything.  

if (dependTest.equals(FIELD_TEST_EQUAL)) {
this_required = dependTestValue.equalsIgnoreCase(dependVal);
}



Making it so, actually does the comparison

   if (dependTest.equals(FIELD_TEST_EQUAL)) {

this_required = dependTestValue.equalsIgnoreCase(dependVal);
String dependPropValue =
ValidatorUtil.getValueAsString(bean, dependProp);
if ( ! dependTestValue.equals( dependPropValue ) ){
   return false;
}
   }
   

Thanks, 

Jeremy Weber
[EMAIL PROTECTED]

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: RequiredIf Example Request

2003-01-24 Thread Weber, Jeremy
Sorry I am not following you. I am trying to to use the 'requiredif'
validation not 'required' validation.  I dont have xml defining the field.
Just what I had posted in the previous message to illustrate my problem.  I
am currently looking at the code of requiredif to see if its functioning
properly.

You say to use required, mycheck.  But I cant require the field.  I need to
require it conditionally based on another field in the form.  That is why I
want to use requiredif.  Based on whether a field is true or false, validate
some other fields, kind of thing...

As for as the code for RequiredIf, it doesnt seem to me to handle EQUALS
well.  

boolean required = false;

...
...
...
if (dependTest.equals(FIELD_TEST_EQUAL)) {
this_required =
dependTestValue.equalsIgnoreCase(dependVal);
}
...
...

if (required) {
if ((value != null) && (value.length() > 0)) {
return true;
} else {
errors.add(field.getKey(), Resources.getActionError(request,
va, field));
return false;
}
}
}
No where does it seem to compare the xml value and the value on the actual
form.




If you have any other suggestions or can clarify, please do...  


Jeremy Weber
[EMAIL PROTECTED]


-Original Message-
From: Dennis Muhlestein [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 24, 2003 3:39 PM
To: Struts Users Mailing List
Subject: RE: RequiredIf Example Request


I just barely ran into this problem.  Seems that all the field checks
are run.  Checking the Validator example (TowFieldCheck) in the struts
docs (1.1b3), It seems that if the value is null, you should let it pass
as accepted.

The xml defining the field is the one that should specify that the field
is required.  id: required,mycheck

Then it becomes possible to have an optional field.

-Dennis

On Thu, 2003-01-23 at 14:33, Weber, Jeremy wrote:
> Yes, but I would think that it would only be run after the first
validation
> (the requiredif) runs.  Is that not a correct assumption?  Do I need to
add
> anything to the exists validation to make it so?  In your example if the
> requiredif fails, does it still try to run the next validations?
> 
> 
> 
> Jeremy Weber
> [EMAIL PROTECTED]
> 
> 
> -Original Message-
> From: Greg Murray [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 23, 2003 4:20 PM
> To: Struts Users Mailing List
> Subject: RE: RequiredIf Example Request
> 
> 
> I'm not sure "exists" is a standard validation rule.  Did you define it
> yourself?
> 
> -Original Message-
> From: Weber, Jeremy [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 23, 2003 2:00 PM
> To: 'Struts Users Mailing List'
> Subject: RE: RequiredIf Example Request
> 
> 
> Thank you , thank you, thank you!
> 
> I misspoke when I said checkboxs, its a radio button, like this...
> 
>   
> 
>key="appserver.usesecure.displayname"/>
>onclick="showSecureOptions('true');"/> Yes
>onclick="showSecureOptions('false');"/> No
> 
> 
> 
> depends="requiredif,exists">
>   key="appserver.sslkeystore.displayname"/>
>  
>   field[0]
>   useSecure
>   
>   
>   field-test[0]
>   EQUAL
>   
>   
>   field-value[0]
>   true
>   
>   
> 
> 
> >From what I can tell, this looks like it will work... But it doesnt.
> However, this is the kicker... If I remove exists from depends, it acts as
> it should.  Now I figured that exists would only be called if requiredif
> passed.  Any thoughts?
> 
> 
> 
> 
> 
> 
> Jeremy Weber
> [EMAIL PROTECTED]
> 
> 
> -Original Message-
> From: Greg Murray [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, January 23, 2003 3:26 PM
> To: Struts Users Mailing List
> Subject: RE: RequiredIf Example Request
> 
> 
> If you're just requesting an example of something, here's what I'm
currently
> using:
> 
>depends="requiredif,integer,minlength,maxlength">
> 
> 
> 
> 
> 
>   minlength
>   9
> 

Out of my Mind/Struts Bug???

2003-01-24 Thread Weber, Jeremy
It seems to me that whenever I use requiredif and an additional custom
validation to validate the same field, the requiredif always passes and
therefore the second validation is called.  

Below I have cut some snippets from my code.  What I want to do is, require
properties B & C if property A is true.  Then after they are required I want
to do more validation.  Specifically I need to be able to call custom
validators such 'portRange'.  If I replace portRange in VALIDATION.XML
(below) with an included validation like integer or email, it works
perfectly.  Why the difference between the custom validation and the shipped
ones?  Perhaps I am not including something in my portRange definition or
code that is needed?  Or perhaps I am just out of my mind...:)

If someone smarted than me could check this out I would appreciate it


TESTFORM.JSP

















VALIDATION.XML





field[0]
a


field-test[0]
EQUAL


field-value[0]
true





field[0]
a


field-test[0]
EQUAL


field-value[0]
true









And the actual code is this...

public static boolean validatePortRange(java.lang.Object
bean,
  org.apache.commons.validator.ValidatorAction va,
  org.apache.commons.validator.Field field,
  org.apache.struts.action.ActionErrors errors,
  javax.servlet.http.HttpServletRequest request ) {

  System.out.println("In PortRange
method");
  String temp = ValidatorUtil.getValueAsString(bean,
field.getProperty());
  String field1 = field.getProperty();
  System.out.println("FIELD: " + field1);
  System.out.println("VALUE: " + temp);
  String sProperty2 =
field.getVarValue("secondProperty");
  Map userData = (Map)
(request.getSession(false).getAttribute("userData"));
  int number =
Integer.parseInt(userData.get(sProperty2).toString());
  Integer test;
  Enumeration enum;



  System.out.println("NUM: " + number +
"");

  Vector v = VectorUtil.convert(temp);
  if (v == null){

errors.add(field.getKey(),StrutsValidatorUtil.getActionError(request,va,fiel
d));
 System.out.println("First failure");
 return false;
  } else if (v.size() != number){
 System.out.println(v.size());
 System.out.println("Second failure");

errors.add(field.getKey(),StrutsValidatorUtil.getActionError(request,va,fiel
d));
 return false;
  } else {
 //check to see if port nums make min max values
  enum = v.elements ();
  while (enum.hasMoreElements ()){
test = (Integer)enum.nextElement();
System.out.println("TEST: " + test);
if (test.intValue() < 1 ||
test.intValue() > 65535){
System.out.println("Third
failure");
return false;
}
  }


  }
return true;
}

Thanks

Jeremy Weber
[EMAIL PROTECTED]

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Default Form Values

2003-01-24 Thread Weber, Jeremy
Where should the default values for forms go?  In the jsp, form bean or some
other config file?

Thanks

Jeremy Weber
[EMAIL PROTECTED]

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: RequiredIf Example Request

2003-01-23 Thread Weber, Jeremy
Yes, but I would think that it would only be run after the first validation
(the requiredif) runs.  Is that not a correct assumption?  Do I need to add
anything to the exists validation to make it so?  In your example if the
requiredif fails, does it still try to run the next validations?



Jeremy Weber
[EMAIL PROTECTED]


-Original Message-
From: Greg Murray [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 23, 2003 4:20 PM
To: Struts Users Mailing List
Subject: RE: RequiredIf Example Request


I'm not sure "exists" is a standard validation rule.  Did you define it
yourself?

-Original Message-----
From: Weber, Jeremy [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 23, 2003 2:00 PM
To: 'Struts Users Mailing List'
Subject: RE: RequiredIf Example Request


Thank you , thank you, thank you!

I misspoke when I said checkboxs, its a radio button, like this...




 Yes
 No



 
   
   
field[0]
useSecure


field-test[0]
EQUAL


field-value[0]
true




>From what I can tell, this looks like it will work... But it doesnt.
However, this is the kicker... If I remove exists from depends, it acts as
it should.  Now I figured that exists would only be called if requiredif
passed.  Any thoughts?






Jeremy Weber
[EMAIL PROTECTED]


-Original Message-
From: Greg Murray [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 23, 2003 3:26 PM
To: Struts Users Mailing List
Subject: RE: RequiredIf Example Request


If you're just requesting an example of something, here's what I'm currently
using:

  





  minlength
  9
 

  maxlength
  9


  field[0]
  lastName


  field-test[0]
  NULL

  

This makes studentId required if lastName is NULL.  If I also wanted to add
a requirement to make studentId required if firstName was null, I'd add the
following to the above:


  field[1]
  lastName


  field-test[1]
  NULL


The conditions you can have are NULL, NOTNULL, and EQUAL.

I haven't used this with checkboxes yet, but I think you'd probably have
each of your three fields use requiredif, and use something like the
following to make it depend on the checkbox:


  field[0]
  checkboxFieldName


  field-test[0]
  NOTNULL


The fact that the example was using indicies screwed me up for a while too
until I took a look at the source code for FieldChecks.

GM

-Original Message-
From: Weber, Jeremy [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 23, 2003 12:57 PM
To: 'Struts Users Mailing List' (E-mail)
Subject: RequiredIf Example Request


I requested this before and have not recieved a response...:(  Any takers
out there?  Currently I am having a heck of time figuring out how to make
this work...  

I have checked out all the online examples, but I am unclear as to what this
stuff means...

If you have this in your struts-config.xml...






My form properties look like...




So I am missing the type and initial fields.  Can anybody help me see the
light?  I need a checkbox to control whether or not 3 addiotional text
fields are required.

Thanks,

Jeremy Weber
[EMAIL PROTECTED]

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


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

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


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

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




RE: RequiredIf Example Request

2003-01-23 Thread Weber, Jeremy
Thank you , thank you, thank you!

I misspoke when I said checkboxs, its a radio button, like this...




 Yes
 No



 
   
   
field[0]
useSecure


field-test[0]
EQUAL


field-value[0]
true




>From what I can tell, this looks like it will work... But it doesnt.
However, this is the kicker... If I remove exists from depends, it acts as
it should.  Now I figured that exists would only be called if requiredif
passed.  Any thoughts?






Jeremy Weber
[EMAIL PROTECTED]


-Original Message-
From: Greg Murray [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 23, 2003 3:26 PM
To: Struts Users Mailing List
Subject: RE: RequiredIf Example Request


If you're just requesting an example of something, here's what I'm currently
using:

  





  minlength
  9
 

  maxlength
  9


  field[0]
  lastName


  field-test[0]
  NULL

  

This makes studentId required if lastName is NULL.  If I also wanted to add
a requirement to make studentId required if firstName was null, I'd add the
following to the above:


  field[1]
  lastName


  field-test[1]
  NULL


The conditions you can have are NULL, NOTNULL, and EQUAL.

I haven't used this with checkboxes yet, but I think you'd probably have
each of your three fields use requiredif, and use something like the
following to make it depend on the checkbox:


  field[0]
  checkboxFieldName


  field-test[0]
  NOTNULL


The fact that the example was using indicies screwed me up for a while too
until I took a look at the source code for FieldChecks.

GM

-Original Message-
From: Weber, Jeremy [mailto:[EMAIL PROTECTED]]
Sent: Thursday, January 23, 2003 12:57 PM
To: 'Struts Users Mailing List' (E-mail)
Subject: RequiredIf Example Request


I requested this before and have not recieved a response...:(  Any takers
out there?  Currently I am having a heck of time figuring out how to make
this work...  

I have checked out all the online examples, but I am unclear as to what this
stuff means...

If you have this in your struts-config.xml...






My form properties look like...




So I am missing the type and initial fields.  Can anybody help me see the
light?  I need a checkbox to control whether or not 3 addiotional text
fields are required.

Thanks,

Jeremy Weber
[EMAIL PROTECTED]

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


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

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




RequiredIf Example Request

2003-01-23 Thread Weber, Jeremy
I requested this before and have not recieved a response...:(  Any takers
out there?  Currently I am having a heck of time figuring out how to make
this work...  

I have checked out all the online examples, but I am unclear as to what this
stuff means...

If you have this in your struts-config.xml...






My form properties look like...




So I am missing the type and initial fields.  Can anybody help me see the
light?  I need a checkbox to control whether or not 3 addiotional text
fields are required.

Thanks,

Jeremy Weber
[EMAIL PROTECTED]

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RequiredIf Example

2003-01-15 Thread Weber, Jeremy
Can someone post the necessary code to show a working requiredif validation.
I can seem to get this going per my prior post (attached).

Hello all, 

I have a field that I wish to validate based on the results of another
field.  The other field 'useSecure' returns a string of true or false from 2
radio buttons.  I wish to validate a field called 'sslKeyStore' if useSecure
= true.  If it returns false no validation.  I have tried the following...
but it still gets called.


   
   
field
useSecure


field-test
EQUAL


field-value
true




I have also tried the following...

   
   
field[0]
useSecure


field-test[0]
EQUAL


field-value[0]
true



I am unclear as to what field-indexed means, so I tried it to, with same
results as above.  Any ideas why this isnt working?

Thanks!

Jeremy Weber
[EMAIL PROTECTED]

--
To unsubscribe, e-mail:

For additional commands, e-mail:




Jeremy Weber
[EMAIL PROTECTED]

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Required If

2003-01-14 Thread Weber, Jeremy
Hello all, 

I have a field that I wish to validate based on the results of another
field.  The other field 'useSecure' returns a string of true or false from 2
radio buttons.  I wish to validate a field called 'sslKeyStore' if useSecure
= true.  If it returns false no validation.  I have tried the following...
but it still gets called.


   
   
field
useSecure


field-test
EQUAL


field-value
true




I have also tried the following...

   
   
field[0]
useSecure


field-test[0]
EQUAL


field-value[0]
true



I am unclear as to what field-indexed means, so I tried it to, with same
results as above.  Any ideas why this isnt working?

Thanks!

Jeremy Weber
[EMAIL PROTECTED]

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Design Help

2003-01-14 Thread Weber, Jeremy
Hello all,

I have a unique requirement and was wondering if anyone had any ideas on how
to implement it.  I am using struts to install our server based product.
Our product has several components which can be installed multiple times. If
you choose to install a component you have to provide some configuration
information for each instance installed.  So if you install 5 times, you
need to configure some port 5 times.  I would like the configuration screens
to accept text in the following format.

Port: ,,,,.

I can validate that there are 5 entries, no problem.  How do I then validate
each individual entry as being an integer and in the valid port range.  If
anyone has any suggestions, I would appreciate it.

Thanks,

Jeremy Weber
[EMAIL PROTECTED]

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




More Validation Problems

2002-12-19 Thread Weber, Jeremy
I thought I had this licked in my first form.  I was able to get the default
validations to work along with a couple of custom ones:)  However, not on a
subsequent form.  The required validation and two custom ones work on the
first form, but not on the second.  Its like the never even are attempted.
So once again I am stuck.:(  Can anyone give me any suggestions on trouble
shooting a validation that doesnt get called.  Maybe some advanced logging
switches or something to that extent.  I have also included portions of my
config files if it may help.

Anyway, if you can think of anything, thanks again.

Jeremy

APPSERVER.JSP
-















...





VALIDATION.XML
--


First Form Works










   
   
mask
^http.*$






VALIDATION-RULES (this works on first form)
---
   



STRUTS-CONFIG.XML
-






 
  
  
  


  
   

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: Simple Custom Validation Example Request

2002-12-18 Thread Weber, Jeremy
Yes.

  
  
  

I assume thats all I need but I am running out of ideas, as to why I cant
get this work:(

Thanks


Jeremy

-Original Message-
From: James Turner [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 18, 2002 11:23 AM
To: 'Struts Users Mailing List'
Subject: RE: Simple Custom Validation Example Request


Do you have both validation_rule.xml and validation.xml in the list in
your plug-in definition in struts-config.xml?

James

> -Original Message-
> From: Weber, Jeremy [mailto:[EMAIL PROTECTED]] 
> Sent: Wednesday, December 18, 2002 11:18 AM
> To: 'Struts Users Mailing List'
> Subject: RE: Simple Custom Validation Example Request
> 
> 
> Still no go.  I had some problems with my package paths etc., 
> but that wasnt the cause either.  The default validations do 
> work but do I need to do anything else in struts-config.xml?
> 
> 
> Thanks
> 
> 
> Jeremy
> 
> -Original Message-
> From: Alireza Fattahi [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, December 18, 2002 10:33 AM
> To: 'Struts Users Mailing List'
> Subject: RE: Simple Custom Validation Example Request
> 
> 
> Here is sample.
> 
> Hope it helps. One question are default validations like 
> required working? If not check your struts_config.xml.
> 
> Validation_rule.xml:
> 
>classname="com.sgccir.struts.validations.EmailValidator"
>   method="isEmail"
>   methodParams="java.lang.Object,
> org.apache.commons.validator.ValidatorAction,
> org.apache.commons.validator.Field,
> org.apache.struts.action.ActionErrors,
> javax.servlet.http.HttpServletRequest"
>   msg="errors.email" />
> 
> 
> 
> validation.xml
>   
> 
>   
>   
> mask
> ^[a-zA-Z]*$
>   
> 
>   
> 
> 
> 
> public static boolean isEmail( java.lang.Object bean,
>  
> org.apache.commons.validator.ValidatorAction va,
>  
> org.apache.commons.validator.Field field,
>  org.apache.struts.action.ActionErrors
> errors,
>  javax.servlet.http.HttpServletRequest
> request ) {
> log.trace( "In isEmail() method" );
> 
> boolean blIsValidEmail = true;
> ..
> 
> }
> 
> 
> -Original Message-
> From: Weber, Jeremy [mailto:[EMAIL PROTECTED]] 
> Sent: Wednesday, December 18, 2002 6:07 PM
> To: 'Struts Users Mailing List' (E-mail)
> Subject: Simple Custom Validation Example Request
> 
> Could someone post the very simplest example of some custom 
> validation code. I am still having problems with my code as 
> explained in previous post below. Maybe if I start of smaller 
> I could make some sense of whats going on. 
> 
> 
> 
> Thanks,
> 
> 
> Jeremy
> 
> 
> Im trying to start of simple with a custom validaton method.  
> Currently all it contains is a system.out to verify that the 
> method never gets called. Can some one verify that my 
> configuration is correct?  I would appreciate it.
> 
> 
> validator-rules.xml
> 
>   classname="com.vs.install.util.VsValidate"
>method="validateIdentical"
>methodParams="java.lang.Object,
>  org.apache.commons.validator.ValidatorAction,
>  org.apache.commons.validator.Field,
>  org.apache.struts.action.ActionErrors,
>  javax.servlet.http.HttpServletRequest"
> 
>depends="required"
>msg="errors.identical"
>   />
> 
> 
> validation.xml
>   
>  depends="required,integer">
>key="newinstall.vsynchnum.displayname"/>
>   
>  depends="required,integer,identical">
>key="newinstall.vsappnum.displayname"/>
>   
>depends="required">
>  key="newinstall.installdir.displayname"/>
> 
>   
>   
> 
> package com.vs.util.validate;
> 
> import java.io.Serializable;
> import java.util.Locale;
> import javax.servlet.ServletContext;
> import javax.servlet.http.HttpServletRequest;
> import org.apache.struts.action.ActionErrors;
> import org.apache.comm

RE: Simple Custom Validation Example Request

2002-12-18 Thread Weber, Jeremy
I dont know what the deal is but its working now.  

Thanks for all your suggestions.

--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: Simple Custom Validation Example Request

2002-12-18 Thread Weber, Jeremy
Still no go.  I had some problems with my package paths etc., but that wasnt
the cause either.  The default validations do work but do I need to do
anything else in struts-config.xml?


Thanks


Jeremy

-Original Message-
From: Alireza Fattahi [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 18, 2002 10:33 AM
To: 'Struts Users Mailing List'
Subject: RE: Simple Custom Validation Example Request


Here is sample.

Hope it helps. One question are default validations like required working?
If not check your struts_config.xml.

Validation_rule.xml:





validation.xml
  

  
  
mask
^[a-zA-Z]*$
  

  



public static boolean isEmail( java.lang.Object bean,
 
org.apache.commons.validator.ValidatorAction va,
 org.apache.commons.validator.Field field,
 org.apache.struts.action.ActionErrors
errors,
 javax.servlet.http.HttpServletRequest
request ) {
log.trace( "In isEmail() method" );

boolean blIsValidEmail = true;
..

}


-Original Message-
From: Weber, Jeremy [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, December 18, 2002 6:07 PM
To: 'Struts Users Mailing List' (E-mail)
Subject: Simple Custom Validation Example Request

Could someone post the very simplest example of some custom validation code.
I am still having problems with my code as explained in previous post below.
Maybe if I start of smaller I could make some sense of whats going on. 



Thanks,


Jeremy


Im trying to start of simple with a custom validaton method.  Currently all
it contains is a system.out to verify that the method never gets called. Can
some one verify that my configuration is correct?  I would appreciate it.


validator-rules.xml

  


validation.xml








  




package com.vs.util.validate;

import java.io.Serializable;
import java.util.Locale;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.commons.validator.Field;
import org.apache.commons.validator.GenericValidator;
import org.apache.commons.validator.ValidatorAction;
import org.apache.commons.validator.ValidatorUtil;
import org.apache.struts.util.StrutsValidatorUtil;
import java.text.*;
import java.util.*;

public final class VsValidate implements Serializable  {

public VsValidate() {
}


public static boolean validateIdentical(Object bean, ValidatorAction
va, Field field, ActionErrors errors, HttpServletRequest request){
   System.out.println("entered method");

return true;
}



}




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

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

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




Simple Custom Validation Example Request

2002-12-18 Thread Weber, Jeremy
Could someone post the very simplest example of some custom validation code.
I am still having problems with my code as explained in previous post below.
Maybe if I start of smaller I could make some sense of whats going on. 



Thanks,


Jeremy


Im trying to start of simple with a custom validaton method.  Currently all
it contains is a system.out to verify that the method never gets called. Can
some one verify that my configuration is correct?  I would appreciate it.


validator-rules.xml

  


validation.xml








  




package com.vs.util.validate;

import java.io.Serializable;
import java.util.Locale;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.commons.validator.Field;
import org.apache.commons.validator.GenericValidator;
import org.apache.commons.validator.ValidatorAction;
import org.apache.commons.validator.ValidatorUtil;
import org.apache.struts.util.StrutsValidatorUtil;
import java.text.*;
import java.util.*;

public final class VsValidate implements Serializable  {

public VsValidate() {
}


public static boolean validateIdentical(Object bean, ValidatorAction
va, Field field, ActionErrors errors, HttpServletRequest request){
   System.out.println("entered method");

return true;
}



}




--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Validation Method Not Called

2002-12-17 Thread Weber, Jeremy
Im trying to start of simple with a custom validaton method.  Currently all
it contains is a system.out to verify that the method never gets called. Can
some one verify that my configuration is correct?  I would appreciate it.


validator-rules.xml

  


validation.xml








  




package com.vs.util.validate;

import java.io.Serializable;
import java.util.Locale;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.commons.validator.Field;
import org.apache.commons.validator.GenericValidator;
import org.apache.commons.validator.ValidatorAction;
import org.apache.commons.validator.ValidatorUtil;
import org.apache.struts.util.StrutsValidatorUtil;
import java.text.*;
import java.util.*;

public final class VsValidate implements Serializable  {

public VsValidate() {
}


public static boolean validateIdentical(Object bean, ValidatorAction
va, Field field, ActionErrors errors, HttpServletRequest request){
   System.out.println("entered method");

return true;
}



}





--
To unsubscribe, e-mail:   
For additional commands, e-mail: