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
> 

RE: RequiredIf Example Request

2003-01-24 Thread Dennis Muhlestein
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
>  
> 
>   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 the

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 Greg Murray
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]>




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]>




RE: RequiredIf Example Request

2003-01-23 Thread Greg Murray
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:   
For additional commands, e-mail: 


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