Welcome Guest, Not a member yet? Register   Sign In
this EDITABLE DIV is in my web form[ADD/EDIT] - how get POST data FROM THIS ? FORM SU
#1

(This post was last modified: 06-26-2018, 07:14 AM by lsepolis123.)

<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???
Reply
#2

(This post was last modified: 06-26-2018, 07:27 AM by qury. Edit Reason: updated response )

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

(This post was last modified: 06-26-2018, 08:42 AM by lsepolis123.)

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???
Reply
#4

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




Theme © iAndrew 2016 - Forum software by © MyBB