My webform is submitted even if I have not provided input for required fields

Issue

My web form is submitted even if I have not provided input for required fields.

Solution

There are two possible causes for this issue:

  • If you use your own submit button with a custom ID (e.g. btnSubmit) instead of the default WorkflowGen submit button ID (SubmitButton), you need to provide the following attribute: ValidationGroup = WFGENPage. For more information, see the My .NET validator does not trigger the validation error message article.

  • You have included custom validation using JavaScript and the code breaks at some point.

For example:

function YOUR_JAVASCRIPT_FUNCTION(source, arguments)
{ 
 var ValidateResult = true; 
 // ---- your javascript code to set the ValudateResult ---- 
 // arguments.IsValid = ValidateResult; 
}

If there is an error in your JavaScript code that is not being trapped properly, the JavaScript code will break and end the execution of the WorkflowGen validation process and allow WorkflowGen to submit without considering the form invalid.

To make sure your custom code functions correctly for debugging, you can do the following:

  • Add a regular .NET button with an ID not equal to SubmitButton and with ValidationGroup=WFGENPage. It will just perform a post back of your web form without submitting it to WorkflowGen while it will still trigger WorkflowGen form validation process.

  • Add a JavaScript alert() function to show your custom validation result. If the alert is not triggered this may signify that a line of code breaks. You can consider using an external debugger such FireBug to trace which line causes the error.