Rails validation over redirect

I think you have two problems here. Keeping validation errors through a redirect Repopulating the form fields so the user doesn’t have to enter all the information again. Both of these things are connected. Validation errors are usually displayed through the error_msg_for method which acts on an object. Usually provided by the controller as the … Read more

How to cleanse (prevent SQL injection) dynamic SQL in SQL Server?

I believe there are three different cases that you have to worry about: strings (anything that requires quotes): ”” + replace(@string, ””, ”””) + ”” names (anything where quotes aren’t allowed): quotename(@string) things that cannot be quoted: this requires whitelisting Note: Everything in a string variable (char, varchar, nchar, nvarchar, etc.) that comes from user-controlled … Read more

How to display dialog only on complete of a successful form submit

The PrimeFaces ajax response puts an args object in the JS scope which has a validationFailed property. You could just check for that in the oncomplete. <p:commandButton … oncomplete=”if (args &amp;&amp; !args.validationFailed) dialogaboutDEQ.show()” /> If you’re performing validation in action method instead of in a normal validator, and you can’t rework that, then you need … Read more

HTML5 Required input styling

You can use :valid and :invalid selectors. Something like this .field:valid { border-color:#0f0; } .field:invalid { border-color:#f00; } However, this will only work in browsers that support native validation, and only for fields that make sense. As far as I know, right now that only means Chrome (maybe Safari, but haven’t checked). So by native … Read more