I have a custom VisualForce page I am wanting to add client-side validation to, so that when the user is filling out the form, if the previous field they filled out does not pass the validation (I'm using regex for this part) they will immediately be notified with red text next to the field explaining what the issue is along with a red border around that field, all without needing to hit submit.

Is something like this possible? I have searched online but cannot find any resources to get me started with this in VisualForce.

  • 2
    Hey Josh. While what you are suggesting sounds like a nice UX, this isn't provided by Salesforce, would take a LOT of effort to implement (especially if you were trying to leverage built-in validation rule and trigger side effects etc.) and would result in an inconsistent UX for people who use that page with many other (perhaps standard Salesforce) pages. As such I would recommend that you abandon this idea. – Phil W Jul 1 '19 at 15:43
  • Thanks @PhilW. I've been moving forward already with just some validation on the Apex side as that's quick and easy, was just curious if this is something I could improve upon as it feels a bit clunky requiring the user to hit submit and possibly seeing 10 things they need to correct. – Josh Jul 1 '19 at 16:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.