17488 Posts in 4473 Topics by 1978 members
|Go to End|
17 August 2008 at 6:28pm Last edited: 17 August 2008 6:29pm
I have added two float fields (storing latitude and longitude) to my member table. All works fine, but I am unable to save any data to the DB from the member popup cms in the admin. If I comment out the fields for the floats everything works.
What is the proper way to add fields to the cms to except float data?
I have tried these two with no success...
$fields->push(new NumericField("lat", "Latitude"));
$fields->push(new NumericField("lng", "Longitude"));
$fields->push(new TextField("lat", "Latitude"));
$fields->push(new TextField("lng", "Longitude"));
18 August 2008 at 1:23pm Last edited: 18 August 2008 1:23pm
what type of database fields are they saving into? try making them just 'Varchar' fields and see if it saves
18 August 2008 at 1:35pm
The database fields were originally created as
'lat' => 'float(10,6)',
'lng' => 'float(10,6)'
Which prevented any data from the Member cms popup from writing to the database.
Using Varchar database fields works fine.
'lat' => 'Varchar(30)',
'lng' => 'Varchar(30)'
Is there a reason why I was/am having trouble with the float fields? I tried setting them as 'null' and also as 'not null' with the same results, Member fields wouldn't update from the cms popup.
18 August 2008 at 1:52pm
because float needs a capital F I guess as that db array does not use SQL eg float() type in MySQL but rather they should point to the wrapper in SilverStripe and for float its Float (uppercase F) try that and see how it goes.
18 August 2008 at 2:31pm Last edited: 18 August 2008 2:32pm
Great. Thanks for pointing out that oversight willr.
'lat' => 'Float(10,6)',
'lng' => 'Float(10,6)'
Uppercase F, and everything is playing nice now.
|Go to Top|