Reputation: 661
For a project I'm using Sitecore Webforms For Marketers (WFFM). I have created a webform with some custom fieds e.g. required checkbox (created conform the manual, page 19). The manual contains the following note: "In the Web Forms for Marketers module, the Checkbox field does not support the 'required' validation rule". There is also a special field: the captcha field. All fields are required.
Now I have a problem with the order of the validation messages are displayed. If the textbox fields are empty, the required field messages are displayed. After the text fields are filled in and not the checkbox is checked, the checkbox error message is displayed. I want them to be displayed all at once.
Does anyone know how to do that?
Thanks a lot.
Jordy
Upvotes: 2
Views: 923
Reputation: 307
WFFM have some limitation. You can apply jquery custom validations but that is not good solution. this may be helpful http://petersondave.wordpress.com/tag/web-forms-for-marketers/
Upvotes: 0
Reputation: 2017
You can use JQuery to manage this think. If you want I can share some code as well.
Upvotes: 1
Reputation: 1155
Bit of a stab in the dark, but: Does the custom code you've created to validate your checkbox use only server-side validation?
The last time I encountered a similar issue (where one group of fields were validated first, and then another group were validated later) it wasn't using WFfM, but it turned out that the set of fields being validated first were triggering a client-side validation script. Since these are run in the browser, they always happen before any validation code which runs on the server.
You may be able to fix the problem by getting your custom checkbox field to register a client-side validation script.
Depending on how your custom field is working there are different ways you could make this happen. One pattern would be to create a CustomValidator control which contains both your server-side and client-side validation logic, and add that to your custom field control. MSDN describes the basic process here:
How to: Validate with a Custom Function for ASP.NET Server Controls
An alternative pattern might be to use a more generic approach to registering a block of custom script which gets run when your page renders:
Working with Client-Side Script
And that block could contain script to hook into the validation process.
Upvotes: 0
Reputation: 21
Try unchecking client side validation tickbox for each of your fields in Sitecore content tree.
This will allow you to fill in all fields and it will only validate after you have clicked the submit button.
Upvotes: 0