CMS MADE SIMPLE FORGE

Form Builder

 

[#7063] UDT validation doesn't work properly with standard validation

avatar
Created By: arnaud vincent (shekars)
Date Submitted: Mon Oct 31 07:00:16 -0400 2011

Assigned To: Ryan Foster (RytoEX)
Version: 0.7.1
CMSMS Version: None
Severity: Major
Resolution: Fixed
State: Closed
Summary:
UDT validation doesn't work properly with standard validation
Detailed Description:
When I use an UDT while validating my form, it ignores the standard field
validation (ie: if the UDT says OK, the form is validated, and the standard
validations are not made :required fields control , etc.)

What I suppose: in the 'validate()' method of the form class, the udt seems to
be
called inside the loop control of every field, when I suppose it had to be
called after this loop, if there is no error.
As it also use an inside loop with the variable $i, I assume it breaks the main
loop wich also use the $i counter : the udt is called with the first field of
the form, then breaks the loop.


History

Comments
avatar
Date: 2011-10-31 07:30
Posted By: Tapio Löytty (Stikki)

Will look into this at the evening.

-Stikki-
      
avatar
Date: 2012-01-30 16:47
Posted By: dave johnson (davemadesimple)

This seems to have been around for a long time. Is there any official
resolution?
I've edited the Validate() function in
"/modules/FormBuilder/classes/Form.class.php", closing the first fields loop
just before the test
"if( $validated == true && !empty($udt) && "-1" != $udt )" (line 550 or so)
instead of just before the final return.
This seems to be what the code should do, and the results are now what I'd
expect.
      
avatar
Date: 2012-02-29 12:47
Posted By: Ryan Foster (RytoEX)

Took me a bit, but I've reproduced this.

Steps to reproduce
1. Create a UDT that simply does this:  return array(true);
2. Create a new form.
3. Add a non-required text input with the "Field Validation" option set to
"Integer".
3.a. Optionally, add a required text input.
4. Create a page with the form on it.
5. Open the page with the form on it.
6. Click submit on the form.

As long as the first field passes its built-in validation, and the UDT's own
validation passes, all other fields' built-in validation options will be
ignored.

I'll check on the solution provided by Dave Johnson later today.
      
avatar
Date: 2012-03-16 09:32
Posted By: Sjoerd Adema (sjadema@gmail.com)

I have reproduced the above issue and can confirm that the solution posted by
Dave Johnson takes care of this problem. Please integrate the provided solution
in your repository.
      
avatar
Date: 2012-04-10 05:49
Posted By:  (bobemoe)

Also experiencing this problem.   Added a UDT to validate a pair of fields
together (requires one OR the other), if this UDT passes then the standard
validation is ignored and the whole form passes!

I too can confirm the above solution (moving closing brace in Form.class.php)
fixes the problem.


      
avatar
Date: 2012-04-12 13:39
Posted By: Sjoerd Adema (sjadema@gmail.com)

To elaborate on this problem and the solution posted by Dave Johnson;

Close the for-loop before the UDT preferences get called. This happens on line
545 or 546. You should close the for-loop before "$usertagops =
$gCms->GetUserTagOperations();" is being called.
      
avatar
Date: 2013-09-02 15:56
Posted By: Tapio Löytty (Stikki)

Someone will check this.
      
avatar
Date: 2014-10-24 03:28
Posted By: Rolf (rolf1)

Fixed in SVN
      
avatar
Date: 2015-01-21 10:46
Posted By: Rolf (rolf1)

FB 0.8.1 is released
      
avatar
Date: 2015-05-26 22:52
Posted By: jackets (jackets)

ndash; Spirit of love, http://www.secondnaturecanvas.com/ is still a long way to
go. Insisting on zero tolerance to punish corruption,
      
Updates

Updated: 2015-01-21 10:46
state: Open => Closed

Updated: 2014-10-24 03:28
resolution_id: 6 => 7

Updated: 2013-09-02 15:56
resolution_id: 5 => 6
cmsms_version_id: 29232 => -1
assigned_to_id: 11306 => 13490

Updated: 2011-10-31 07:30
resolution_id: => 5