simple,
If i implement any editor and HTML from the html view or the source view. the content is not saved.
⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠
Posted 14 July 2014 - 10:31 AM
simple,
If i implement any editor and HTML from the html view or the source view. the content is not saved.
Posted 14 July 2014 - 15:51 PM
that should not be practically the problem.. check up what all data is being posted.. !!
also.. do share in the code and table structure and we might be able 2 help u
Posted 15 July 2014 - 10:11 AM
that should not be practically the problem.. check up what all data is being posted.. !!
also.. do share in the code and table structure and we might be able 2 help u
table structure
Code:
public function manageEmailers() { if(checkSession()){ $this->load->library('grocery_CRUD'); $crud = new grocery_CRUD(); $crud->set_theme('flexigrid'); $crud->set_table('emailers'); $crud->columns('email_subject', 'trigger_on', 'is_active'); $crud->field_type('is_active','dropdown',array('0'=>'no', '1' => 'yes')); $crud->required_fields('email_subject', 'email_body', 'static_text'); $crud->columns('email_subject', 'email_body', 'trigger_on'); $state = $crud->getState(); if($state == 'add' || $state == 'edit'){ $data['admin_js'] = "jQuery(document).ready(function() {jQuery('#email_body_input_box').prepend('<div class=\'admin_notice\'><b>Dynamic keywords:</b> {site_url}, {activation_link}, {user_full_name}, {user_profile_link}, {daily_v_convos}, {static_text} <br> <b>Usage syntax : welcome {user_full_name}, thank you </b> </div>');});"; } $crud->set_js('js/crud.js'); $crud->post_ajax_callbacks('trigLinks()'); $crud->unset_read(); $crud->unset_delete(); $crud->unset_texteditor('email_body'); $output = $crud->render(); $data['title']="Manage Emailers"; $data['adminMenu']=1; $output = array_merge($data,(array)$output); $this->_outputData($output); } else{ $this->session->set_flashdata('msg', 'Your session has expired please login again'); redirect('welcome/index'); return; } }
Posted 15 July 2014 - 22:24 PM
well... if you notice the post in the firebug when u submitting the data .. it is looking for value in email_body
where as as per the code it seems the value is being collected into email_body_input_box - now both are separate fields all together..
it is possible you trying to control the field output to the set text editor using the js file.. but you not getting the same field name.. rather getting it as another field name. My recomendation - do maintain the field name .. or remove the email_body as compulsary field
Secondly.. do add a callback_before_insert
where u 1st copy the content of new field set to email_body
secondly - remove the new field as it is not there in table it will throw up error
Hope the soltuion works 4 u...
Happy GCing:)
Posted 25 July 2014 - 07:27 AM
alright its saving now. but here is another problem.
Its not saving the inline style of a copy pasted html code, even when i paste it in the source as html itself..
Any good reasons?
Posted 25 July 2014 - 15:45 PM
Well to my understanding.. if u analyze / realize the code that gets stored in backend.. the html in it is having the html tags converted to special chars so b4 u display it back.. use html_entity_decode for it.. !!! That should work 4 u..!!
Posted 28 July 2014 - 06:29 AM
Solution found at
http://blog.codebusters.pl/en/codeigniter-202-tinymce-or-ckeditor-style-attribute-lost-after-update
create a file called "MY_Security.php" in application/code
code
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); /** * * Extend Security controller * */ class MY_Security extends CI_Security { function __construct() { parent::__construct(); } protected function _remove_evil_attributes($str, $is_image) { // All javascript event handlers (e.g. onload, onclick, onmouseover), style, and xmlns $evil_attributes = array('on\w*', 'xmlns'); if ($is_image === TRUE) { /* * Adobe Photoshop puts XML metadata into JFIF images, * including namespacing, so we have to allow this for images. */ unset($evil_attributes[array_search('xmlns', $evil_attributes)]); } do { $str = preg_replace( "#<(/?[^><]+?)([^A-Za-z\-])(".implode('|', $evil_attributes).")(\s*=\s*)([\"][^>]*?[\"]|[\'][^>]*?[\']|[^>]*?)([\s><])([><]*)#i", "<$1$6", $str, -1, $count ); } while ($count); return $str; } }
thats it.
Posted 28 July 2014 - 07:54 AM
great.. good work... thank you for sharing it might help others too :)