CodeIgniter Forums
this EDITABLE DIV is in my web form[ADD/EDIT] - how get POST data FROM THIS ? FORM SU - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=11)
+--- Thread: this EDITABLE DIV is in my web form[ADD/EDIT] - how get POST data FROM THIS ? FORM SU (/showthread.php?tid=71007)



this EDITABLE DIV is in my web form[ADD/EDIT] - how get POST data FROM THIS ? FORM SU - lsepolis123 - 06-26-2018

<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???


RE: this EDITABLE DIV is in my web form[ADD/EDIT] - how get POST data FROM THIS ? FORM SU - qury - 06-26-2018

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]'); 



RE: this EDITABLE DIV is in my web form[ADD/EDIT] - how get POST data FROM THIS ? FORM SU - lsepolis123 - 06-26-2018

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???


RE: this EDITABLE DIV is in my web form[ADD/EDIT] - how get POST data FROM THIS ? FORM SU - lsepolis123 - 06-26-2018

(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???