CodeIgniter Forums

Full Version: this EDITABLE DIV is in my web form[ADD/EDIT] - how get POST data FROM THIS ? FORM SU
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
<div style="height: 600px; overflow-y: scroll; overflow-x:hidden;" class='col-md-12 sol-sm-12' contenteditable='true' id='user_notes_for_video' name='user_notes_for_video'></div>


can you help? 
this EDITABLE DIV is in my web form[ADD/EDIT] - how get POST data FROM THIS ? FORM SUBMITTED AS post REQUEST...


NORMALLY FOR TEXT AREA I HAD IN THE CONTROLLER - Now what must be done ?

                'user_notes_for_video' => $this->input->post('user_notes_for_video')


Also in HTML5 - how limit in this writable DIV the characters and html data pictures etc to 1200 chars???
You can use jquery to get the text from the div and submit that using ajax.


PHP Code:
    $('#yourformid').on('submit', function (el) {
 
           var editableData = $('#user_notes_for_video').text();
 
           $.ajax({
 
               url'<?= site_url('your_controller/method') ?>',
 
               method'POST',
 
               data: {notes:editableData},
 
               success: function (data) {
 
                       //do something
 
               },
 
           });
 
           // stop from calling this multiple times
 
           el.stopImmediatePropagation();
 
           return false;
 
       }); 

As for editing the data, you can do that in form validation in your controller like this:

PHP Code:
$this->form_validation->set_rules('notes''User Notes''max_length[1200]'); 
Other way is create a hidden text field ... and put  a jQuery when change div area change hidden field to be the same - in other words div editable ==hidden and submit hidden field normally as $this->input->post('user_notes_for_video') ... this can work???
(06-26-2018, 08:41 AM)lsepolis123 Wrote: [ -> ]Other way is create a hidden text field ... and put  a jQuery when change div area change hidden field to be the same - in other words div editable ==hidden and submit hidden field normally as $this->input->post('user_notes_for_video') ... this can work???

also div have any max length css attr .. ? so as when filled up 1200 chars Can Not write anything in div editable???