Ive created a custom field type as a module using the Field API.
The field is a textfield that I then enhance with javascript to be hidden and its replaced with a custom world map where the user can drag a pin point around to mark a location (basic pixel coords - not google maps related).
It all works fine and the input's value is updated with a js array string of x/y pixel numbers ex: "[100,200]".
The problem is after submit the string is saved to the DB as "[" but the db field is a varchar(255).
I also tried making the string only numbers seperated with a comma like so "100,200" but only "1" is saved so its not an issue with the square brackets (its just a string after all) for some reason only the first chracter is saved.
Would really appreciate some advice on what could be going wrong
Cheers
Comments
You can potentially run into
You can potentially run into this issue if you try to set a string
$foo, to a value like$foo['bar'] = 'value';, so I'd check to make sure that any arrays that you're creating are properly declared before you're setting values in the array, i.e.$foo = array();. If that doesn't help, post the code.Heres the module code
Heres the .module code it may be Im missing something since I had to assemble it from various sources since no single example fully explains what each method is for:
The .install files schema