numeric field returned with quotes

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

numeric field returned with quotes

Adam Witney

Hi,

I have a numeric type field:

  "gestation", { data_type => "numeric", is_nullable => 1 },

but when I call the accessor I get a quoted number:

use Data::Dumper;
die Dumper($self->gestation);

$VAR1 = '31';

This causes problem as when it gets turned into json, I get this

{ "gestation": "31"}

But then the javascript front end complains when it tries to load it in an input[number] field

Am I doing something wrong, or misunderstanding something?
Thanks

Adam

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@...
Reply | Threaded
Open this post in threaded view
|

Re: numeric field returned with quotes

Dmitry Latin
Try DBIx::Class::Helper::Row::NumifyGet

On 17 April 2015 at 18:44, Adam Witney <[hidden email]> wrote:

>
> Hi,
>
> I have a numeric type field:
>
>   "gestation", { data_type => "numeric", is_nullable => 1 },
>
> but when I call the accessor I get a quoted number:
>
> use Data::Dumper;
> die Dumper($self->gestation);
>
> $VAR1 = '31';
>
> This causes problem as when it gets turned into json, I get this
>
> { "gestation": "31"}
>
> But then the javascript front end complains when it tries to load it in an input[number] field
>
> Am I doing something wrong, or misunderstanding something?
> Thanks
>
> Adam
>
> _______________________________________________
> List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
> Searchable Archive: http://www.grokbase.com/group/dbix-class@...



--
//wbr, Dmitry L.

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@...
Reply | Threaded
Open this post in threaded view
|

Re: numeric field returned with quotes

Adam Witney

Great, thanks, that did it!


> Try DBIx::Class::Helper::Row::NumifyGet
>
> On 17 April 2015 at 18:44, Adam Witney <[hidden email]> wrote:
> >
> > Hi,
> >
> > I have a numeric type field:
> >
> >   "gestation", { data_type => "numeric", is_nullable => 1 },
> >
> > but when I call the accessor I get a quoted number:
> >
> > use Data::Dumper;
> > die Dumper($self->gestation);
> >
> > $VAR1 = '31';
> >
> > This causes problem as when it gets turned into json, I get this
> >
> > { "gestation": "31"}
> >
> > But then the javascript front end complains when it tries to load it in an
> input[number] field
> >
> > Am I doing something wrong, or misunderstanding something?
> > Thanks
> >
> > Adam
> >
> > _______________________________________________
> > List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
> > IRC: irc.perl.org#dbix-class
> > SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
> > Searchable Archive: http://www.grokbase.com/group/dbix-
> [hidden email]
>
>
>
> --
> //wbr, Dmitry L.
>
> _______________________________________________
> List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
> IRC: irc.perl.org#dbix-class
> SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
> Searchable Archive: http://www.grokbase.com/group/dbix-
> [hidden email]

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@...