Autor | Zpráva | ||
---|---|---|---|
radas Profil * |
#1 · Zasláno: 21. 11. 2011, 09:28:21
Zdravím,
potřeboval bych poradit jak získat hodnotu z textarea pro ajax když používám tiny mce. Pro odesílání formuláře "napozadí" používám tento skript http://www.simonerodriguez.com/ajax-form-submit-example/ funguje dobře, jenže v momentě když tam přidám tiny mce tak obsah z textarea se neodesílám (hodnota POST je prázdna), někde jsem se dozvěděl že tiny mce nějak generuje celý html editor, ale už jsem nenašel jak se k tomu přistupuje. Neporadil by mi někdo? |
||
Someone Profil |
#2 · Zasláno: 21. 11. 2011, 09:50:46
Prostě tomu textarea z tinymace přiřaď name.
|
||
radas Profil * |
#3 · Zasláno: 21. 11. 2011, 09:57:56
tak to má nastavena name...jen ta hodnota se nezobrazuje...když dam print_r($_POST) tak se mi zobrazí nazev textarea ale ne obsa...narozdíl od jinych proměnnych...v tom chyba neni...
|
||
Someone Profil |
#4 · Zasláno: 21. 11. 2011, 10:10:19 · Upravil/a: Someone
edit: Nevšiml jsem si, že jsme v JS a že se jedná o ajax, omluvám se.
|
||
radas Profil * |
#5 · Zasláno: 21. 11. 2011, 10:17:03
ten ajax s použitim tiny mce?
|
||
Medvídek Profil |
#6 · Zasláno: 21. 11. 2011, 10:20:44 · Upravil/a: Medvídek
radas:
Našel sem příklad u nich na webu: function ajaxLoad() { var ed = tinyMCE.get('content'); // Do you ajax call here, window.setTimeout fakes ajax call ed.setProgressState(1); // Show progress window.setTimeout(function() { ed.setProgressState(0); // Hide progress ed.setContent('HTML content that got passed from server.'); }, 3000); } function ajaxSave() { var ed = tinyMCE.get('content'); // Do you ajax call here, window.setTimeout fakes ajax call ed.setProgressState(1); // Show progress window.setTimeout(function() { ed.setProgressState(0); // Hide progress alert(ed.getContent()); }, 3000); } |
||
radas Profil * |
#7 · Zasláno: 21. 11. 2011, 10:25:43
taky jsem se na to dival,
mám to nastavene tinyMCE.init({ // General options language : "cs", mode : "textareas", theme : "advanced", forced_root_block : false, force_br_newlines : true, force_p_newlines : false, plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template", // Theme options theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,sub,sup", theme_advanced_buttons2 : "bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,code", theme_advanced_buttons3 : "tablecontrols", theme_advanced_buttons4 : "formatselect,fontselect,fontsizeselect", theme_advanced_buttons4 : ",inserttime,preview,|,forecolor,backcolor,|,hr,charmap,iespell,fullscreen", theme_advanced_toolbar_location : "bottom", theme_advanced_toolbar_align : "left", theme_advanced_statusbar_location : "bottom", theme_advanced_resizing : true, entity_encoding : "raw", // Example content CSS (should be your site CSS) //content_css : "../data/css/content.css", // Drop lists for link/image/media/template dialogs template_external_list_url : "../data/lists/template_list.js", external_link_list_url : "../data/lists/link_list.js", external_image_list_url : "../data/lists/image_list.js", media_external_list_url : "../data/lists/media_list.js", }); function ajaxLoad() { var ed = tinyMCE.get('zprava'); // Do you ajax call here, window.setTimeout fakes ajax call ed.setProgressState(1); // Show progress window.setTimeout(function() { ed.setProgressState(0); // Hide progress ed.setContent('HTML content that got passed from server.'); }, 3000); } function ajaxSave() { var ed = tinyMCE.get('zprava'); // Do you ajax call here, window.setTimeout fakes ajax call ed.setProgressState(1); // Show progress window.setTimeout(function() { ed.setProgressState(0); // Hide progress alert(ed.getContent()); }, 3000); } *textarea se jmenuje zprava volám to hned po nastaveni tiny mce |
||
radas Profil * |
#8 · Zasláno: 21. 11. 2011, 20:45:39
asi to nebude uplně ideální ale touhle funkcí
function textarea_obsah(Id) { var zprava; zprava=( tinyMCE.get(Id).getContent() ); alert(zprava); //teď si ji jen zobrazuji abych viděl že ji opravdu získam } se dostanu k obsahu co je v textarea, teď mě napada, jestli bych třeba tuto hodnotu mohl přenest do inputu typu hidden <input type="hidden" name="zhidden" id="zhidden" value="" /> |
||
Časová prodleva: 12 let
|
0