HashanChamara / php-form-builder-class

Automatically exported from code.google.com/p/php-form-builder-class
0 stars 0 forks source link

Ajax validation fails to show error messages #188

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a Ajax form that requires validation
2. Submit the form with fields that will fail validation

What is the expected output?
    Error messages should be pre-pended to the form.

What do you see instead?
    No error messages.

What version of the product are you using? On what operating system?
    r598, PHP 5.4

Please provide any additional information below.
    It turns out the error is with the Ajax response being interpreted as a string instead of a JSON object such that the check if(... response.errors) is undefined and the error messages are not added to the form. By adding response = JSON.parse(response); before line 338 in PFBC/Form.php the problem is solved.

My diff is available here: 
https://github.com/lkorth/php-form-builder-class/commit/aebd8e65c597cac020b4f7aa
d4145e36256a6fab

Original issue reported on code.google.com by korth.l...@gmail.com on 1 Dec 2012 at 8:44

GoogleCodeExporter commented 8 years ago
As a note, I have only tested the issue and fix in Chrome, it may not happen in 
other browsers and the fix may or may not fix it in other browsers.

Original comment by korth.l...@gmail.com on 1 Dec 2012 at 8:45