Validations All at Once

andyss 18 Dec, 2011
Hey guys,

In my form, I have an Auto Server Side Validation event, a Custom Server Side Validation event and a Recaptcha. Is there a way to have any errors produced by all of these events show up at once? So if there are errors in all three validation events, instead of the ASSV showing errors on submit, then the user resubmits and then the CSSV shows it's errors on the second submit, and so on for the recaptcha, can all errors show up on one submit? (Hope I'm clear enough in my explanation :? ).

Thanks,

Andy
GreyHead 20 Dec, 2011
Hi Andy,

I think I've cracked this one.

Organise the actions so that the Custom ServerSide validation runs last. In the other two actions drag Custom Code actions to the On Fail event and put this code into the Code box of the action
<?php
$form->data['error'] = true;
?>

For the Custom Serverside validation drag an Event Loop to the On Fail event and add this code to the Code box after any other validation code.
<?php
if ( isset($form->data['error']) && $form->data['error'] ) {
  return false;
}
?>

Bob
andyss 20 Dec, 2011
Thanks again Bob, worked like a charm!

Andy
This topic is locked and no more replies can be posted.