2

In Sitecore WFFM if we add a required field, it displays the error in the top(which is OOB).

Is it possible to display in different areas of WFFM. Example

  1. Next to the text box.
  2. Displaying it as popup.
2

PVM, I'm assuming you are using Webforms? as the validators are in-line in MVC but are a validation group at the top of the page in the Webforms version. I wouldn't recommend a pop-up as this won't be a nice UI on Mobile. Moving the validation to an in-line validator looks to be a bit tricky in Webforms as it looks like the validators are all generated server-side.

There are 3 options I can see here:

1) Update the server side validation to be in-line

I haven't fully tested this but it seems to work ok:

Edit the validation summary here and turn off the validation by setting ShowSummary="false": Website\sitecore modules\Web\Web Forms for Marketers\Control\SitecoreSimpleFormAscx.ascx

<asp:ValidationSummary ID="summary" runat="server" ShowSummary="false" ValidationGroup="submit" CssClass="scfValidationSummary"/>

Then add some Javascript that runs on all wffm pages that loops the validators and grabs the text from the title field and replaces the * with the full validation text:

(function ($) {
    $(document).ready(function() {
       $('.scfValidatorRequired').each(function(index) {
         $(this).text($(this).attr("title"));
        });
    });
})($scw);

2) Use Client Side Validation Only

A bit clunky but you could not enable validation in the WFFM Form Builder add instead add your own Javascript validation on submit of any form with Jquery, something like:

$(".scfForm > input[type='submit']").on('submit', onSubmit);

3) Switch to the MVC version of WFFM

You will then get in-line validation as standard and much more control over the layout of the fields etc.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.