Re: additional onsubmit javascript validation
Hi Dale, I'm just using the xhtml theme, but I missed that chunk of code in xhtml/form-validate.ftl. That's what I needed. Thanks, /robert - Original Message - From: "Dale Newfield" To: "Struts Users Mailing List" Cc: "Robert Taylor" Sent: Thursday, September 23, 2010 1:51 PM Subject: Re: additional onsubmit javascript validation On 9/23/10 7:48 AM, Robert Taylor wrote: I'm not sure modifying the templates will work here. css_xhtml/form-validate.ftl contains: <#if parameters.onsubmit??> ${tag.addParameter('onsubmit', "${parameters.onsubmit}; return validateForm_${parameters.id}();")} <#else> ${tag.addParameter('onsubmit', "return validateForm_${parameters.id}();")} If you override that file and change one line like so: <#if parameters.onsubmit??> ${tag.addParameter('onsubmit', "return (validateForm_${parameters.id}() && ${parameters.onsubmit});")} <#else> ${tag.addParameter('onsubmit', "return validateForm_${parameters.id}();")} and make your onsubmit attribute just be javascript that generates a true/false value (FOO) instead of "return FOO", then I think you'll get what you want. -Dale - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: additional onsubmit javascript validation
(And binding an event to onclick or onsubmit doesn't mean that existing handlers have to go away, depending on how you do it, or if you save existing handlers.) On Thu, Sep 23, 2010 at 1:51 PM, Dale Newfield wrote: > On 9/23/10 7:48 AM, Robert Taylor wrote: > >> I'm not sure modifying the templates will work here. >> > > css_xhtml/form-validate.ftl contains: > ><#if parameters.onsubmit??> >${tag.addParameter('onsubmit', "${parameters.onsubmit}; return > validateForm_${parameters.id}();")} ><#else> >${tag.addParameter('onsubmit', "return validateForm_${parameters.id > }();")} > > > If you override that file and change one line like so: > ><#if parameters.onsubmit??> >${tag.addParameter('onsubmit', "return (validateForm_${ > parameters.id}() && ${parameters.onsubmit});")} ><#else> >${tag.addParameter('onsubmit', "return validateForm_${parameters.id > }();")} > > > and make your onsubmit attribute just be javascript that generates a > true/false value (FOO) instead of "return FOO", then I think you'll get what > you want. > > -Dale > > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > >
Re: S2 overriding a Localization property
Provide a more-specific location--so as long as they can create a package- or class-level properties file that's more specific there's no issue. Are you looking for a different mechanism than that? Dave On Thu, Sep 23, 2010 at 5:02 PM, Greg Lindholm wrote: > How do you override a Localization property that is bundled in a > ActionClass.properties file? > > I'm planing on bundling up some common Action classes into a jar to be > used by several projects. I plan on putting their properties in > ActionClass.properties files that get bundled into the jar. > > I would like the individual projects to be able to override the > supplied properties if they need to. I'm looking at the "Resource > Bundle Search Order" and it appears that it will in the > ActionClass.properties file and if it finds the property it will stop > looking any further. So how do you override? > > Thanks > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > >
S2 overriding a Localization property
How do you override a Localization property that is bundled in a ActionClass.properties file? I'm planing on bundling up some common Action classes into a jar to be used by several projects. I plan on putting their properties in ActionClass.properties files that get bundled into the jar. I would like the individual projects to be able to override the supplied properties if they need to. I'm looking at the "Resource Bundle Search Order" and it appears that it will in the ActionClass.properties file and if it finds the property it will stop looking any further. So how do you override? Thanks - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: additional onsubmit javascript validation
On 9/23/10 7:48 AM, Robert Taylor wrote: I'm not sure modifying the templates will work here. css_xhtml/form-validate.ftl contains: <#if parameters.onsubmit??> ${tag.addParameter('onsubmit', "${parameters.onsubmit}; return validateForm_${parameters.id}();")} <#else> ${tag.addParameter('onsubmit', "return validateForm_${parameters.id}();")} If you override that file and change one line like so: <#if parameters.onsubmit??> ${tag.addParameter('onsubmit', "return (validateForm_${parameters.id}() && ${parameters.onsubmit});")} <#else> ${tag.addParameter('onsubmit', "return validateForm_${parameters.id}();")} and make your onsubmit attribute just be javascript that generates a true/false value (FOO) instead of "return FOO", then I think you'll get what you want. -Dale - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: additional onsubmit javascript validation
Hi Dave, Based on my requirements (leverage the existing Struts2 client-side validation framework), I'm not sure modifying the templates will work here. It appears that when validate="true" I need a way to tell Struts2 validation framework to not populate the onsubmit attribute. But I still want it to generate the appropriate javascript based on the field validations I have defined for the action. This way I could use my own onsubmit handler to call the auto-generated javascript method (validatForm_MyAction()) at the appropriate time. Reviewing the existing template files didn't reveal that this was possible by overriding a template. Maybe I missed something. /robert - Original Message - From: "Dave Newton" To: "Struts Users Mailing List" Sent: Wednesday, September 22, 2010 9:44 PM Subject: Re: additional onsubmit javascript validation I modified the templates to allow pages to inject their own validation messages. Unfortunately I never checked this in. You could do it with a JavaScript framework, though, through binding. Dave On Wed, Sep 22, 2010 at 9:26 PM, Robert Taylor wrote: Greetings, I'm using Struts2.2.1 and have a form using the xhtml theme which performs some simple javascript validation (required, etc...). Works great. Now, after the simple javascript validation executes I would like to add some more validation to the onsubmit event. Apart from modifying a template, I couldn't see how this could be achieved easily. If you include the validation in the form onsubmit attribute, it is prepended to the dynamically generated javascript validation function name. For example: produces the following markup. As is evident, this won't work for me. I want to leverage the dynamically generated Javascript validation when validate="true". If that validation succeeds, then I want to execute some proprietary validation. I also know the name of the dynamically generated javascript method so I could call it in myValidation(); Any suggestions would be appreciated. Thanks, /robert - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: additional onsubmit javascript validation
Hi Mead, Binding validation to the click event on the submit button is not what i want. This would fire my validation before the onsubmit validation occurs. I want to leverage the Struts2 javascript validation framework which already exists. Then, if that succeeds, I would like to fire additional javascript validation. The Struts2 validation framework dynamically generates the appropriate validation for the form if the form has validate="true". Otherwise it doesn't generate it. However, when validate="true", it appends "return validateForm_MyAction();" as an onsubmit handler to any existing onsubmit attribute value. With regards to your second suggestion "removing the onsubmit event". I cannot do this (without modifying code/template) because if validate="true" in the form, it will automatically populate the form onsubmit attribute. If I set validate="false", then the Struts2 validation framework doesn't auto-generate the form javascript validation. /robert - Original Message - From: "Mead Lai" To: "Struts Users Mailing List" Sent: Wednesday, September 22, 2010 9:50 PM Subject: Re: additional onsubmit javascript validation Hi Robert, Do you have another submit button? such as , Try to bind a event listener to this button, that when you click this button, you do some validation(); Another way is using the js to remove the "onsubmit" event, then binding another method you write, and invoke the myValidation() in that method; bind AnoterMethod(){ if(!validateForm_MyAction()){return;} //Here do your validation return myValidation() } Regards, Mead - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Struts 2.2.1 Problem
Maybe it's related to that http://blog.o0o.nu/2010/07/cve-2010-1870-struts2xwork-remote.html I've added some more restrictive rules regarding request's parameters names. Lot of special characters are disallowed, take a look on line 138 http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/interceptor/ParametersInterceptor.java?view=markup You can always declare yours own by declaring acceptParamNames for that interceptor. Regards -- Łukasz + 48 606 323 122 http://www.lenart.org.pl/ Kapituła Javarsovia 2010 http://javarsovia.pl - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: Bizarre sporadic problem with streaming a stylesheet.
I wrote: > > Apologies for being late to the party, but this smells like a > browser/proxy > cache issue to me? > and then mgainty wrote: > > > i agree with andy > > do a view source and tracert on all urls > > i it is possible you'll see there is a man-in-the middle proxy altering > the response > > I'd just to like to note that I don't share Martin's paranoia. It's just that I know that when I alter static stylesheets in my applications/websites, I often have to force the browsers to refresh them. Pulling them with curl/wget always supplies the correct, current version as in the OP's case but the browser ignores changes because they don't seem to expect changes in style sheets. I don't know off the top of my head if there is a cache pragma that can be stuck into the stylesheet response or tag to prevent such problems, nor have I ever gone hunting for one as this is a minor inconvenience that I generally only suffer during development/debugging sessions. Later, Andy -- View this message in context: http://old.nabble.com/Bizarre-sporadic-problem-with-streaming-a-stylesheet.-tp29766033p29787100.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org