Yes, that was the confusing bit - on the server side it defaults to the date short form if you don't specify a pattern. It would be better if either the javascript defaulted in the same way or "blow up" on the server side if the patterns missing - easier to spot it then.
Niall ----- Original Message ----- From: "Jim Anderson" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Sunday, February 15, 2004 11:39 PM Subject: Re: client-side validation not working > Niall, > > You're absolutely right! Adding the elements you show below did the > trick. It never occurred to me to revisit my validation.xml file since > server-side validation was working fine. > > Thanks very, very much! > > jim > > On Feb 15, 2004, at 1:33 PM, Niall Pemberton wrote: > > > Actually, > > > > I just tried it out and it has to be the datePatternStrict version for > > Struts 1.1 > > > > <var> > > <var-name>datePatternStrict</var-name> > > <var-value>dd/MM/yyyy</var-value> > > </var> > > > > The javascript functions have moved to commons and appear to now cater > > for > > the datePattern variable - so probably from Struts 1.2 you could choose > > which version. > > > > (The difference between datePattern and datePatternStrict is that the > > data > > input has to match the length of the format in the strict version. So > > if for > > example 1/1/2004 would be invalid in strict version with a pattern of > > dd/MM/yyyy - the user would have to key in 01/01/2004 for the date to > > be > > valid. > > > > Niall > > > > ----- Original Message ----- > > From: "Niall Pemberton" <[EMAIL PROTECTED]> > > To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > > Sent: Sunday, February 15, 2004 10:44 AM > > Subject: Re: client-side validation not working > > > > > >> James, > >> > >> In your validation configuration file you have not set the date > >> pattern > >> variable - there are two forms of it - datePattern and > >> datePatternStrict. > >> > >> <formset> > >> > >> <form name="ActivityViewForm"> > >> <field > >> property="starting" > >> depends="date"> > >> <arg0 key="ActivityViewForm.starting.displayname"/> > >> <var> > >> <var-name>datePattern</var-name> > >> <var-value>dd/MM/yyyy</var-value> > >> </var> > >> </field> > >> <field > >> property="ending" > >> depends="date"> > >> <arg0 key="ActivityViewForm.ending.displayname"/> > >> <var> > >> <var-name>datePattern</var-name> > >> <var-value>dd/MM/yyyy</var-value> > >> </var> > >> </field> > >> </form> > >> > >> </formset> > >> > >> Try that. > >> > >> Niall > >> > >> ----- Original Message ----- > >> From: "Anderson, James H [IT]" <[EMAIL PROTECTED]> > >> To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]> > >> Sent: Saturday, February 14, 2004 6:08 PM > >> Subject: RE: client-side validation not working > >> > >> > >>> Yes and yes. > >>> > >>> -----Original Message----- > >>> From: Saul Q Yuan [mailto:[EMAIL PROTECTED] > >>> Sent: Friday, February 13, 2004 4:17 PM > >>> To: 'Struts Users Mailing List' > >>> Subject: RE: client-side validation not working > >>> > >>> > >>> So, did you find the validateDate function, and was it called? > >>> > >>> -----Original Message----- > >>> From: Anderson, James H [IT] [mailto:[EMAIL PROTECTED] > >>> Sent: Friday, February 13, 2004 3:29 PM > >>> To: Struts Users Mailing List > >>> Subject: RE: client-side validation not working > >>> > >>> > >>> Struts 1.1 > >>> > >>> -----Original Message----- > >>> From: Saul Q Yuan [mailto:[EMAIL PROTECTED] > >>> Sent: Friday, February 13, 2004 11:25 AM > >>> To: 'Struts Users Mailing List' > >>> Subject: RE: client-side validation not working > >>> > >>> > >>> Try to put some alerts in the validateDate javascript function in the > >>> validator-rules.xml file and see if the function is called. BTW, what > >>> version of Struts you are using? > >>> > >>> Saul > >>> > >>> -----Original Message----- > >>> From: Anderson, James H [IT] [mailto:[EMAIL PROTECTED] > >>> Sent: Friday, February 13, 2004 10:12 AM > >>> To: Struts Users Mailing List > >>> Subject: RE: client-side validation not working > >>> > >>> > >>> To test the possibility of it being a problem with using html:image > >>> instead of html:submit, I replaced html:image by html:submit but got > >>> the > >>> same result, i.e., the client-side validation is not being invoked. > >>> > >>> -----Original Message----- > >>> From: Niall Pemberton [mailto:[EMAIL PROTECTED] > >>> Sent: Friday, February 13, 2004 9:42 AM > >>> To: Struts Users Mailing List > >>> Subject: Re: client-side validation not working > >>> > >>> > >>> Everything looks OK to me. > >>> > >>> Have you checked what javascript is being generated - use "view > >>> source" > >>> in your browser when you are looking at the page. is there a > >>> validateActivityViewForm() method and is that method doing the > >>> validations you expect? > >>> > >>> A second thought is how are you submitting your page - I had problems > >>> when I was using javascript with a link tag. If your doing that, then > >>> try putting an ordinary submit button on the page and see if that > >>> works. > >>> > >>> <html:submit>Save</html:submit> > >>> > >>> Niall > >>> > >>> > >>> ----- Original Message ----- > >>> From: "Anderson, James H [IT]" <[EMAIL PROTECTED]> > >>> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > >>> Sent: Friday, February 13, 2004 2:23 PM > >>> Subject: client-side validation not working > >>> > >>> > >>> Server-side validation is working fine, but I can't seem to get > >>> client-side working. > >>> > >>> I know I must be doing something wrong, but I can't figure out what > >>> it > >>> is :-( > >>> > >>> Here's a bit of the tile that uses validation: > >>> > >>> <%@ taglib uri="/tags/struts-bean" prefix="bean" %> > >>> <%@ taglib uri="/tags/struts-html" prefix="html" %> > >>> <%@ taglib uri="/tags/struts-logic" prefix="logic" %> > >>> > >>> <html:form action="/SelectActivity" onsubmit="return > >>> validateActivityViewForm(this)"> > >>> <TABLE border="0" cellspacing="0" cellpadding="0" align="center"> > >>> ... > >>> <html:text property="starting" value="" size="10"/> ... > >>> <html:text property="ending" value="" size="10"/> > >>> ... > >>> <logic:messagesPresent> > >>> <html:messages id="error"> > >>> <TR><TD><FONT color="red"><STRONG><bean:write > >>> name="error"/></STRONG></FONT><TD><TR> > >>> </html:messages> > >>> </logic:messagesPresent> > >>> </TABLE> > >>> </html:form> > >>> <html:javascript formName="ActivityViewForm"/> > >>> > >>> Here's the piece of validation.xml: > >>> > >>> <formset> > >>> > >>> <form name="ActivityViewForm"> > >>> <field > >>> property="starting" > >>> depends="date"> > >>> <arg0 key="ActivityViewForm.starting.displayname"/> > >>> </field> > >>> <field > >>> property="ending" > >>> depends="date"> > >>> <arg0 key="ActivityViewForm.ending.displayname"/> > >>> </field> > >>> </form> > >>> > >>> </formset> > >>> > >>> Here's the Action entry from struts-config: > >>> > >>> <action > >>> path="/SelectActivity" > >>> name="ActivityViewForm" > >>> type="portfolio.SelectActivityAction" > >>> input=".activity.detail"/> > >>> > >>> > >>> ActivityViewForm extends PortfolioForm which is declared thusly: > >>> > >>> public class PortfolioForm extends ValidatorForm implements > >>> Serializable > >>> { > >>> > >>> As I said, server-side validation is working fine, but the > >>> javascript on > >>> the client-side isn't getting activated. > >>> > >>> I hope someone can help me to resolve this quickly! > >>> > >>> Thanks very much, > >>> > >>> jim > >>> > >>> > >>> > >>> > >>> --------------------------------------------------------------------- > >>> 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] > >>> > >>> --------------------------------------------------------------------- > >>> 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] > >> > >> > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > jim > > > --------------------------------------------------------------------- > 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]