Wdrożyłem następujący skrypt na stronę http://www.aquim.com/web-article-229.html.
Wszystko pięknie funkcjonuje poza jedną rzeczą mianowicie zaimplementowany Nic Edit nie współpracuje z skryptem live.
Skrypt live-edit działa następująco:
Wpisując dane w pole input bądź textarea zapisuje je do określonej komórki w bazie danych bez konieczności skorzystania z buttonu, jednakże gdy zaimplementowałem NicEdit za pole textarea nie zapisuje danych. Prawdopodobnie trzeba zmienić coś w kodzie JS NicEdit (zapewne wystarczy jedną linijkę
![smile.gif](http://forum.php.pl/style_emoticons/default/smile.gif)
Kod JS Live Edit:
<script type="text/javascript"> // JQUERY: Plugin "autoSumbit" (function($) { $.fn.autoSubmit = function(options) { // VARIABLES: Input-specific var input = $(this); var column = input.attr(\'name\'); // VARIABLES: Form-specific var form = input.parents(\'form\'); var method = form.attr(\'method\'); var action = form.attr(\'action\'); // VARIABLES: Where to update in database var where_val = form.find(\'#where\').val(); var where_col = form.find(\'#where\').attr(\'name\'); // ONBLUR: Dynamic value send through Ajax input.bind(\'blur\', function(event) { // Get latest value var value = input.val(); // AJAX: Send values $.ajax({ url: action, type: method, data: { val: value, col: column, w_col: where_col, w_val: where_val }, cache: false, timeout: 10000, success: function(data) { // Alert if update failed if (data) { alert(data); } // Load output into a P else { $(\'#notice\').text(\'Updated\'); $(\'#notice\').fadeIn().delay(1000).fadeOut(); } } }); // Prevent normal submission of form return false; }) }); } })(jQuery); $(function(){ $(\'#ajax-form TEXTAREA\').autoSubmit(); $(\'#ajax-form INPUT\').autoSubmit(); }); </script>
NicEdit:
http://chomikuj.pl/martini007/nicEdit,3561044923.js