Salesforce Form Validation Enhanced

I have a dream, and in this dream form-validation is not a chore. All the nasty work is done client-side, and we – the developers – control what an error message says and where it says it! Server-side validation?! Pah, I spit in it’s general direction (but only if no ladies are present). I don’t need or want client-server round-trips.. I want speed, I want beauty, I want control; and I think you do too.

Our end goal: A neat, realtime, client-side validation technique for VisualForce.

Using either inputFields, Apex exception handling and/or the ‘required’ attribute in VisualForce, we have a number of mechanisms to deal with form-validation, but if we’re honest with ourselves, they’re the ten-thousands-spoons when all we need is a knife. I know you’ve heard me singing it’s praise from the rooftops, but yet again, jQuery is here to save the day.

Read more

Multiple forms in a single VisualForce page

I thought I’d post a quick tip I picked up from Jill Wetzler, Visualforce(and, I suspect JavaScript) Legend. When developing pages that contain more than a single area that could be submitted(not necessarily refreshed) I would usually wrap these areas with forms. Jill pointed out that I’d been a silly bloke(my words, not hers) and could use a single form and wrap each area with an<apex:actionregion> tag.

Read more