vitalets / x-editable

In-place editing with Twitter Bootstrap, jQuery UI or pure jQuery
http://vitalets.github.io/x-editable
MIT License
6.51k stars 1.72k forks source link

custom fields #786

Open kodeine opened 9 years ago

kodeine commented 9 years ago

as mentioned here last input is Custom input, several fields I got that all right, but when the data is stored in db as an object, on page refresh it doesnt show the same data else it shows some comma's.

this gets stored in db. {"city":"11111","state":"2222","building":"333333"}

but it doesnt output in field values. any suggestions?

kodeine commented 9 years ago

Alright so in db, i store the address as {"city":"aaa","street":"bb","building":"ccc"} and in javascript i've put it as,

type: 'address',
showbuttons: 'bottom',
placement: 'top',

It does not populate the fields with the data from db.

Any one can set me to the right direction?

kodeine commented 9 years ago

Solution

did not work {"row":"some data", "address":{"city":"aaa","street":"bb","building":"ccc"}}

converting the address data with single quotes ' worked.

worked {"row":"some data", "address":{'city':'aaa','street':'bb','building':'ccc'}}

zipho commented 9 years ago

where did you convert the address data? is that in js .editable or in html data-source or something like that. Where did you make the above changes? Thanks

kodeine commented 9 years ago

@zipho i had to do preg_replace in the json from php side. Since i have other data in the json, so i had to replace " with ' in sub objects. so editable ajax can read it.