Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Object (JSON) removed from the view 18 Aug 2013 22:53 #10812

First, thanks tp Tomaselli for this tip on how to get the JSON data type to "work"!

One thing I've noted in testing is that I had extra slashes being added for special characters that the user typed into the fields I was storing into the JSON field, e.g. ', ", etc.

Adding the following code to the fork for my item model took care of things:
protected function prepareTable($table)
	{
		$table->customoptions = stripslashes($table->customoptions);
		parent::prepareTable($table);
	}

Without digging into this in any detail, my assumption is that the data is being prepared for an SQL update/insert statement and slashes are added for that before the JSON encode, which then means that more slashes are being added to the data (and removing them here before the jsonencode call fixes things.)

If I'm missing something I'd love to hear from the experts here :)

Thanks!
Dave

Please Log in or Create an account to join the conversation.

Object (JSON) removed from the view 07 Oct 2013 23:03 #11315

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
This is now working for me

I think this was because the JSON was encoded twice time when model loads for pagination count, and then for listing
Coding is now a piece of cake

Please Log in or Create an account to join the conversation.

Last edit: by admin.
  • Page:
  • 1
Time to create page: 0.073 seconds

Real time saver and great Component Builder tool ! I have been developing with J-Cook Pro Component Builder for several months now and can say with all honesty that this product/service is second to none. The product is feature rich and is being improved and added to all the time. Do yourself a favor if you need to build a Joomla! Component then you can do no wrong in trying the product. You will save on time and effort while being able to deliver your project on time. J-Cook pro does the hard work for you you then have the freedom to fully customise the end result for your own needs. 

One word: Awesome.
Edwardcox (JED)
         

Get Started