progmax / php-form-builder-class

Automatically exported from code.google.com/p/php-form-builder-class
GNU General Public License v3.0
0 stars 0 forks source link

True/False field always gives "field is required" when selecting no and setting field as required #53

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Add a True/False field to a form where input is required
2. Select the option "False" (value 0)
3. The empty() function in the Class will return that the value is not filled 
in because the submitted value for true/false is 1 or 0

What is the expected output? What do you see instead?
It should accept the "No" option as an input choice instead of no input

What version of the product are you using? On what operating system?
latest

Please provide any additional information below.
the class uses the empty() PHP function, which returns FALSE for a value of 0, 
which is the value for the NO option in the True/False type.
Workaround: do not set the field as required.

Original issue reported on code.google.com by uwictpar...@gmail.com on 8 Jun 2010 at 1:44

GoogleCodeExporter commented 9 years ago
Thanks for bringing this to our attention.  I will make the appropriate 
correction, which will be included in the next version release.

Thanks Again!
- Andrew

Original comment by ajporterfield@gmail.com on 8 Jun 2010 at 1:55

GoogleCodeExporter commented 9 years ago
What correction will you make exactly?

In fact for required fields you should check if
A) the $_GET or $_POST variable is set for that field : isset($_GET["var"])
B) the length > 0

When both cases are true, the value was submitted from the form AND the user 
provided some value.

Hope this wouldn't break something... 

Original comment by uwictpar...@gmail.com on 8 Jun 2010 at 3:04

GoogleCodeExporter commented 9 years ago
I made the appropriate changes and posted a new version 1.0.6 download which 
you can find at 
http://code.google.com/p/php-form-builder-class/downloads/detail?name=formbuilde
r.zip&can=2&q=#makechanges.

 You can find the specific changes made in the commit log found at http://code.google.com/p/php-form-builder-class/source/list. 

Original comment by ajporterfield@gmail.com on 9 Jun 2010 at 1:24

GoogleCodeExporter commented 9 years ago
I'm sorry but is everything in the commit log included in this new 1.0.6 
release? Why not releasing 1.0.7 as I see a few changes?

Original comment by uwictpar...@gmail.com on 9 Jun 2010 at 5:02

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I agree with moncojhr.
Can you edit your post and remove my email address? I don't want it to be 
picked up by spammers. How can I change my name on this site? Thanks

Original comment by uwictpar...@gmail.com on 9 Jun 2010 at 5:52

GoogleCodeExporter commented 9 years ago
I changed my Google Profile and now my email address is protected. Moncojhr can 
you remove your post with the emailaddress and recreate it? Thanks a lot.

Original comment by uwictpar...@gmail.com on 9 Jun 2010 at 6:04

GoogleCodeExporter commented 9 years ago
It doesnt appear to be possible to edit a comment...

( http://code.google.com/p/support/issues/detail?id=919 )

So I just deleted my previous comment which said (without his email)

"Yeah, really shouldn't modify an already released version of the class... 
should have just made a 1.0.6.1 or waited until you can release all the changes 
in a 1.0.7.

For now uwictpartner you can use the SVN version, or wait until 1.0.7 is 
released."

Original comment by moncojhr@gmail.com on 9 Jun 2010 at 6:06

GoogleCodeExporter commented 9 years ago
To clarify, version 1.0.6 was updated with the big fix within the 
phpCycleElements() function only - and not the other changes that have been 
made for the 1.0.7 version release.

Typically, I would have waited until the next version release to include these 
changes (the bug fix); however, I felt it to be a large enough problem that it 
made sense to go ahead and patch the 1.0.6 download.

As moncojhr mentioned, you can grab the latest working copy of the project 
through subversion by running...
svn export http://php-form-builder-class.googlecode.com/svn/trunk/ 
php-form-builder-class

- Andrew

Original comment by ajporterfield@gmail.com on 9 Jun 2010 at 1:42