ben545 Posted July 28, 2011 Report Posted July 28, 2011 Hey, I downloaded out of the box the cms tutorial, the new one. Flight CMS. It all works great! Except when you try to save special characters / commas, it won't save to the db, and just deletes everything in the content block. Any guidance? Quote
falkencreative Posted July 28, 2011 Report Posted July 28, 2011 Hey Ben, Thanks for the comment. I'll have to take a look at this issue and get back to you. If this is an issue (I'm assuming you are working from my original files, without any modifications?) hopefully the fix will be relatively simple. Since the CMS allows a couple types of content blocks (textarea, one line text input and WYSIWYG field, if I remember correctly) is it all those types that are having issues? Or one specific one? Quote
ben545 Posted July 28, 2011 Author Report Posted July 28, 2011 WYSIWYG field, I didn't modify anything other then the init to work with my own db and file structure... it doesn't allow special characters like &. I appreciate it. Quote
falkencreative Posted July 28, 2011 Report Posted July 28, 2011 OK, I think I've figured out the issue. This is something that makes sense, but I just didn't think to test for it. Basically, when you are using jQuery's Ajax functionality, it passes all of the data along as a string, with an "&" separating each variable in the string. So "&" characters will obviously break things. If you change this line on 14 of app/cms/view/v_edit.php: var content = $('#field').val(); to var content = encodeURIComponent($('#field').val()); that seemed to fix things for me. Can you put this change in place, and let me know if that took care of things? If so, I'll have to add a short video at the end of the series mentioning this bug fix. See http://www.w3schools.com/jsref/jsref_encodeuricomponent.asp for a description of that function. Quote
ivanpanchev Posted December 9, 2011 Report Posted December 9, 2011 Yes, that worked for me Ben. I had the same issue and spend some time researching. There is also another solution. In ajax call instead of $.ajax({ type: "POST", url: "<?php echo SITE_PATH;?>/app/cms/edit.php", data: dataString, cache: false, success: function(html) { $('#cboxLoadedContent').html(html); } }); can be used that: $.ajax({ type: "POST", url: "<?php echo SITE_PATH;?>/app/cms/edit.php", data: {id: id, field: content, type: type}, cache: false, success: function(html) { $('#cboxLoadedContent').html(html); } }); and content variable gets it's value as usual: var content = $('#field').val(); Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.