You are here: Foswiki>Tasks Web>Item14071 (18 Feb 2017, GeorgeClark)Edit Attach

Item14071: Register script reports zero values as missing registration fields.

pencil
Priority: Normal
Current State: Closed
Released In: 2.1.3
Target Release: patch
Applies To: Engine
Component: FoswikiUIRegister
Branches: Release02x01 master
Reported By: ShipingZhang
Waiting For:
Last Change By: GeorgeClark
Here are the lines 1898 to 1904 in the file:

*
        my @missing = ();
        foreach my $fd ( sort { $a->{name} cmp $b->{name} } @{ $data->{form} } )
        {
            if ( ( $fd->{required} ) && ( !$fd->{value} ) ) {
                push( @missing, $fd->{name} );
            }
        }
*

This piece of code on line 1901, !$fd->{value}, is a bug because it would fail to detect the input 0 which is a legitimate input (one application I've worked on accepts 0 as a valid input). The input should be explicitly tested against empty string, $fd->{value} eq '', or $fd->{value} =~ /^\s*$/ if non-white-space input is to be enforced.

-- ShipingZhang - 15 May 2016

Thanks for the report and the suggested patch. It will be fixed in 2.1.3. The Form field processing treats mandatory fields as having length > 0, So enforcing non-white-space isn't consistent.

-- GeorgeClark - 10 Nov 2016
 

ItemTemplate edit

Summary Register script reports zero values as missing registration fields.
ReportedBy ShipingZhang
Codebase 2.1.2, trunk
SVN Range
AppliesTo Engine
Component FoswikiUIRegister
Priority Normal
CurrentState Closed
WaitingFor
Checkins distro:b8bad3ec3bde
TargetRelease patch
ReleasedIn 2.1.3
CheckinsOnBranches Release02x01 master
trunkCheckins
masterCheckins distro:b8bad3ec3bde
ItemBranchCheckins
Release02x01Checkins distro:b8bad3ec3bde
Release02x00Checkins
Release01x01Checkins
Topic revision: r5 - 18 Feb 2017, GeorgeClark - This page was cached on 18 Nov 2017 - 18:52.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License