How to perform validation and then call another javascript function?

2003-12-29 Thread Clark Kent

I have a form in which upon submit, depending on whether a certain checkbox is checked 
or not, it is directed to a certain action (if checked, then action 1, if unchecked, 
then action 2). With the following code, I am trying to validate the form.  Now I need 
to perform the validation and also depending upon the checkbox condition (checked or 
not) I need to redirect it to one of 2 actions. UpdateSubscription() is a javascript 
function which directs to a certain action and then submits it.  

How can I do both the validation and also call this javascript function to redirect to 
different actions. Can I use any condition within the onsubmit=  ? Any help would be 
appreciated?

 

html:errors /

html:javascript formName=subscriptionForm /

html:form name=subscriptionForm onsubmit=return validateSubscriptionForm(this);

 

html:submit property=submitEnrollment value=Submit 

onclick=updateSubscription();/

 

/html:form

 

 



-
Do you Yahoo!?
Yahoo! Photos - Get your photo on the big screen in Times Square

Is there a way to set variable using Struts?

2003-12-18 Thread Clark Kent
I have the following scriptlet code :

if(tableCounter == 1){

 tableCounter = 2;

} else {

tableCounter = 1;

}

How do I achieve the above code using Struts tags (without using JSTL)?

Thanks,

CK



-
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing

html:submit

2003-12-17 Thread Clark Kent
I am trying to use bean:message for internationalization within the html:submit 
button like this :

html:submit property=physicianSubmit value=bean:message 
key='csc.button.submit'//

There is a key-value pair in the resource bundle.

But it seems to display the following error : Attribute csc.button.submit has no value 

How do I fix this error?

Thanks,

CK

 



-
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing

requiredif validation challenge

2003-12-12 Thread Clark Kent

I use Struts 1.1 and tried to add the patch for the requiredif validator in 
validator-rules.xml.  

Following is the code that I added in the validation.xml for the form.  The form has 2 
fields and only one of them can be filled inorder to perform a search.

field property=acctID depends=requiredif, mask
arg0 key=csc.prompt.acctid/
msg name=requiredif key=errors.requiredif/
var
var-namefield[0]/var-name
var-valueuserID/var-value
/var

var
var-namefield-test[0]/var-name
var-valueNULL/var-value
/var
/field



field property=userID depends=requiredif, mask
arg0 key=csc.prompt.userid/
msg name=requiredif key=errors.requiredif/
var
var-namefield[0]/var-name
var-valueacctID/var-value
/var

var
var-namefield-test[0]/var-name
var-valueNULL/var-value
/var 
/field


It seems like inspite of the above, it still doesnt seem to validate requiredif 
validator and proceeds with the submit anyway.  Can someone guide me?

Clark


-
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing

RE: requiredif validation challenge

2003-12-12 Thread Clark Kent
Hi Udaya,
 
Thanks for the corrections.  
 
I have just found out that I am missing the public static boolean validateRequiredIf( 
) 
in the struts-validator.java class which should contain the java functionality to take 
care of requiredif validator.  So it seems like this patch needs to be added onto the 
class file.
 
Clark

Udaya Allu [EMAIL PROTECTED] wrote:
Hi Clark,

The following is similar validation in struts 1.1 final release working fine, for the 
case first field is necessary when second field is null, otherwise one of the two 
shall be available. Do not bother about additional condition of page attribute of page.
It is just show how to use two fields in required if.
The error your code is in in var-name 
change from field-test[0] to fieldTest[0] in final release of struts 1.1
can find this in struts validation doc.
Hope this will help
-Udaya 






field[0]
currentPage


fieldTest[0]
EQUAL


fieldValue[0]
1


field[1]
domain


fieldTest[1]
NULL


fieldJoin
AND






mask
^[a-zA-Z0-9]+([-.]*[a-zA-Z0-9])*$





-Original Message-
From: Clark Kent [mailto:[EMAIL PROTECTED]
Sent: Friday, December 12, 2003 12:01 PM
To: Struts Users Mailing List
Subject: requiredif validation challenge



I use Struts 1.1 and tried to add the patch for the requiredif validator in 
validator-rules.xml. 

Following is the code that I added in the validation.xml for the form. The form has 2 
fields and only one of them can be filled inorder to perform a search.





field[0]
userID



field-test[0]
NULL









field[0]
acctID



field-test[0]
NULL




It seems like inspite of the above, it still doesnt seem to validate requiredif 
validator and proceeds with the submit anyway. Can someone guide me?

Clark


-
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing

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


-
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing

Conditional check for depends clause in Validation.xml

2003-12-11 Thread Clark Kent

I have a scenario where I have 2 textboxes in a form and I need to have the user enter 
either one of the fields but not both.  

field property=acctID depends=required, mask   /field 



field property=userID depends=required, mask   /field

Is there a way that we can provide conditional checks within the depends clause?

Thanks,

CK.

 

 



-
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing

RE: Conditional check for depends clause in Validation.xml

2003-12-11 Thread Clark Kent
How do I use requiredif or validatewhen?  Do you have any examples that I can use 
Udaya.
Thanks,
CK

Udaya Allu [EMAIL PROTECTED] wrote:
use requiredif or validatewhen in the place of required

-Original Message-
From: Clark Kent [mailto:[EMAIL PROTECTED]
Sent: Thursday, December 11, 2003 3:59 PM
To: usergroup
Subject: Conditional check for depends clause in Validation.xml



I have a scenario where I have 2 textboxes in a form and I need to have the user enter 
either one of the fields but not both. 







Is there a way that we can provide conditional checks within the depends clause?

Thanks,

CK.







-
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing

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


-
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing

RE: Conditional check for depends clause in Validation.xml

2003-12-11 Thread Clark Kent
Many Thanks Andy!

Andy Schmidgall [EMAIL PROTECTED] 
wrote:http://jakarta.apache.org/struts/userGuide/dev_validator.html

:)

-Andy

-Original Message-
From: Clark Kent [mailto:[EMAIL PROTECTED] 
Sent: Thursday, December 11, 2003 3:02 PM
To: Struts Users Mailing List
Subject: RE: Conditional check for depends clause in Validation.xml


How do I use requiredif or validatewhen? Do you have any examples that
I can use Udaya. Thanks, CK

Udaya Allu wrote:
use requiredif or validatewhen in the place of required

-Original Message-
From: Clark Kent [mailto:[EMAIL PROTECTED]
Sent: Thursday, December 11, 2003 3:59 PM
To: usergroup
Subject: Conditional check for depends clause in Validation.xml



I have a scenario where I have 2 textboxes in a form and I need to have
the user enter either one of the fields but not both. 







Is there a way that we can provide conditional checks within the depends
clause?

Thanks,

CK.







-
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing

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


-
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing

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



-
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing

RE: Conditional check for depends clause in Validation.xml

2003-12-11 Thread Clark Kent
 
I am currently using Struts 1.1 which means I am gonna have to stick with requiredif 
instead of validwhen.  I tried using the requiredif but to no success. I dont know if 
its the validator that I have below that is causing the problem. This is the validator 
I got off the internet.  Is there a way someone can provide me with the complete 
validation check for requiredif validator.
 

validator name=requiredif

classname=org.apache.struts.util.StrutsValidator

method=validateRequiredIf

methodParams=java.lang.Object,

org.apache.commons.validator.ValidatorAction,

org.apache.commons.validator.Field,

org.apache.struts.action.ActionErrors,

org.apache.commons.validator.Validator,

javax.servlet.http.HttpServletRequest

msg=errors.required

/validator

 

Also when I use the mask, it displays a syntax error.  Without the depends=mask, it 
works but without performing the requiredif check.

field property=acctID depends=requiredif, mask

arg0 key=csc.prompt.acctid/

msg name=requiredif key=errors.requiredif/

var

var-namefield[0]/var-name

var-valueuserID/var-value

/var

var

var-namefield-test[0]/var-name

var-valueallen/var-value

/var

/field



field property=userID depends=requiredif, mask

arg0 key=csc.prompt.userid/

msg name=requiredif key=errors.requiredif/

var

var-namefield[0]/var-name

var-valueacctID/var-value

/var

var

var-namefield-test[0]/var-name

var-valueallen/var-value

/var 

/field

Can someone kindly point out if I am missing something?  Can I use mask along with 
requiredif?
Thanks,
CK.


Andy Schmidgall [EMAIL PROTECTED] wrote:
http://jakarta.apache.org/struts/userGuide/dev_validator.html

:)

-Andy

-Original Message-
From: Clark Kent [mailto:[EMAIL PROTECTED] 
Sent: Thursday, December 11, 2003 3:02 PM
To: Struts Users Mailing List
Subject: RE: Conditional check for depends clause in Validation.xml


How do I use requiredif or validatewhen? Do you have any examples that
I can use Udaya. Thanks, CK

Udaya Allu wrote:
use requiredif or validatewhen in the place of required

-Original Message-
From: Clark Kent [mailto:[EMAIL PROTECTED]
Sent: Thursday, December 11, 2003 3:59 PM
To: usergroup
Subject: Conditional check for depends clause in Validation.xml



I have a scenario where I have 2 textboxes in a form and I need to have
the user enter either one of the fields but not both. 







Is there a way that we can provide conditional checks within the depends
clause?

Thanks,

CK.







-
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing

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


-
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing

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


-
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing

Re: Multiple ApplicationResources.properties files

2003-12-09 Thread Clark Kent
Many Thanks Manish

Manish Singla [EMAIL PROTECTED] wrote:There can be only one default 
message-resources.
Second message-resources should have key attribute.
You have to use this key attribute in jsp custom tags or... to locate 
second message-resources..

HTH
Manish Singla

Clark Kent wrote:
 All,
 
 I am trying to have 2 ApplicationResources.properties file each dealing with 
 different sub-applications. I have created the 2 separate resource bundles along 
 with different entries into the struts-config.xml as follows : 
 
 
 
 
 
 It seems to work fine for subapplication 2 but seems like the key-value pairs cannot 
 be accessed in subapplication 1. Am I missing something? 
 
 Thanks,
 
 CK
 
 
 
 
 
 
 
 -
 Do you Yahoo!?
 New Yahoo! Photos - easier uploading and sharing


-- 
Thanks
Manish Singla
x73166


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



-
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing

Multiple ApplicationResources.properties files

2003-12-08 Thread Clark Kent

All,

I am trying to have 2 ApplicationResources.properties file each dealing with different 
sub-applications.  I have created the 2 separate resource bundles along with different 
entries into the struts-config.xml as follows :  

message-resources null=false parameter=xxx.dev.resources.ApplicationResources /

message-resources null=false 
parameter=xxx.dev.resources.OtherApplicationResources /

It seems to work fine for subapplication 2 but seems like the key-value pairs cannot 
be accessed in subapplication 1.  Am I missing something? 

Thanks,

CK

 





-
Do you Yahoo!?
New Yahoo! Photos - easier uploading and sharing

Re: Clientside Javascript Validator Problem

2003-12-04 Thread Clark Kent
Neil,
 
In the SearchForm, I am curious if it extends ValidatorForm, try to extend ActionForm 
instead to have it to perform client side validation.  Code and configuration appears 
to be fine.
 
Good Luck,
Allen Martis.

Neil Mitchell [EMAIL PROTECTED] wrote:
Hi all

I am unable to get validation working in the clientside. It's fine with serverside but 
will not validate on the clientside.
Here are my config files and jsp any help would be welcomed. Cheers in advance

JSP






alink=#ff00ff background=foo.gif





   








Animal


Jockey


Trainer


Owner








struts-config



-//Apache Software Foundation//DTD Struts Configuration 1.1//EN
http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd;

  This is the Struts configuration file for the example application,
  using the proposed new syntax.
 --








dynamic=true
type=org.apache.struts.validator.DynaValidatorForm 





dynamic=true
type=org.apache.struts.action.DynaActionForm















path=/quickSearch
type=com.arena.skylla.struts.research.actions.QuickSearchAction
scope=request
name=searchForm
input=/researchHome.jsp
validate=true



path=/quickSearchResult
type=com.arena.skylla.struts.research.actions.QuickSearchResultAction
scope=request
name=searchResultsForm
validate=false















  Configuration == --



value=/WEB-INF/validator-rules.xml,
/WEB-INF/validation.xml/





validation.xml



-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.0//EN
http://jakarta.apache.org/commons/dtds/validator_1_0.dtd;

 Validation Rules for the Struts Example Web Application
 
 $Id: validation.xml,v 1.8 2003/05/25 22:51:20 dgraham Exp $
 --








depends=required, minlength

resource=false/

minlength
3











Neil Mitchell
Senior Developer

E-mail: [EMAIL PROTECTED] 
Office: +44 (0)1483 306660
Fax: +44 (0)1483 306670
Web: www.arenaleisureplc.com 
Arena Online Services Ltd, Alexandra House, 1-5 Alexandra Terrace, Guildford Surrey, 
GU1 3DA
**
This e-mail and any attachments may be confidential and/or legally privileged. If you 
are not a named addressee you must not use, disclose, distribute, copy, print or rely 
on this e-mail. Although Arena Online routinely screens for viruses, addressees should 
check this e-mail and attachment for any viruses. Arena Online makes no representation 
or warranty as to the absence of viruses in this e-mail or any attachments. Please 
note that to ensure regulatory compliance and for the protection of our clients and 
business, we may monitor and read e-mails sent to and from our server(s).



Neil Mitchell
Senior Developer

E-mail: [EMAIL PROTECTED] 
Office: +44 (0)1483 306660
Fax: +44 (0)1483 306670
Web: www.arenaleisureplc.com 
Arena Online Services Ltd, Alexandra House, 1-5 Alexandra Terrace, Guildford Surrey, 
GU1 3DA
**
This e-mail and any attachments may be confidential and/or legally privileged. If you 
are not a named addressee you must not use, disclose, distribute, copy, print or rely 
on this e-mail. Although Arena Online routinely screens for viruses, addressees should 
check this e-mail and attachment for any viruses. Arena Online makes no representation 
or warranty as to the absence of viruses in this e-mail or any attachments. Please 
note that to ensure regulatory compliance and for the protection of our clients and 
business, we may monitor and read e-mails sent to and from our server(s).



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


-
Do you Yahoo!?
Free Pop-Up Blocker - Get it now

checkbox condition check

2003-12-04 Thread Clark Kent
I have a situation where I have a table with rows of information.
 

checkbox1 - unique for row1
checkbox2 - unique for row2
checkbox3 - unique for row3

I do know that there are exactly 3 rows of information at all times for this table.  
Now I am trying to get these checkboxes to work based on each unique row.  
 
What kind of struts tag do I use to perform the checkbox to have a check against it or 
not based on whether that particular checkbox info appears in the row because each 
checkbox has its respective getter which returns boolean.
 
some tag to check for condition
  html:checkbox property=a1
end tag


-
Do you Yahoo!?
Free Pop-Up Blocker - Get it now