List Info

Thread: Re: very simple question: Rich Text Editor




Re: very simple question: Rich Text Editor
country flaguser name
United States
2008-03-28 13:01:13



Hi,
I'm having the same problem.

I want to get my textarea values to my $_POST. I've already set the handlesubmit as true,
but it still doesn't work.
I tried to implement it manually using the saveHTML() but I am new to javascript, so I do
not know how to retrieve the variable from php.

(In fact, the form doesn't even submit. I had to add form.submit() to my submit button.)

This is my form tag:

<form action=&quot;$self&quot; method=&quot;post&quot; name=";event_form" id="event_form&quot;>&quot;

This is how I define my textareas:

<textarea id="ev_title&quot; name=";ev_title&quot; wrap=";soft"; type=";text";
name="ev_title";></textarea>

<textarea id="ev_desc&quot; wrap=";soft"; type=";text";
name="ev_desc"></textarea>

This is my javascript code:

//Text Editor
var Dom = YAHOO.util.Dom
var Event = YAHOO.util.Event;

var descriptionConfig = {
handleSubmit: true,
height: '300px',
width: '500px',
dompath: false,
animate: true,
toolbar: {
collapse: true,
titlebar: 'Description',
draggable: false,
buttonType: 'advanced',
buttons: [
{ group: 'fontstyle',
buttons: [
{ type: 'select', label: 'Arial', value: 'fontname', disabled: false,
menu: [
{ text: 'Arial', checked: true },
{ text: 'Arial Black' },
{ text: 'Comic Sans MS' },
{ text: 'Courier New' },
{ text: 'Lucida Console' },
{ text: 'Tahoma' },
{ text: 'Times New Roman' },
{ text: 'Trebuchet MS' },
{ text: 'Verdana' }
]
},
{ type: 'spin', label: '12', value: 'fontsize', range: [ 9, 75 ], disabled: false }
]
},
{ type: 'separator' },
{ group: 'textstyle',
buttons: [
{ type: 'push', label: 'Bold CTRL + SHIFT + B', value: 'bold' },
{ type: 'push', label: 'Italic CTRL + SHIFT + I', value: 'italic' },
{ type: 'push', label: 'Underline CTRL + SHIFT + U', value: 'underline' },
{ type: 'separator' },
{ type: 'color', label: 'Font Color', value: 'forecolor', disabled: false },
{ type: 'color', label: 'Background Color', value: 'backcolor', disabled: true },
{ type: 'push', label: 'HTML Link CTRL + SHIFT + L', value: 'createlink', disabled: true
}
]
},
{ type: 'separator' },
{ group: 'alignment',
buttons: [
{ type: 'push', label: 'Align Left CTRL + SHIFT + [', value: 'justifyleft' },
{ type: 'push', label: 'Align Center CTRL + SHIFT + |', value: 'justifycenter' },
{ type: 'push', label: 'Align Right CTRL + SHIFT + ]', value: 'justifyright' },
{ type: 'push', label: 'Justify', value: 'justifyfull' }
]
},
{ type: 'separator' },
{ group: 'indentlist',
buttons: [
{ type: 'push', label: 'Indent', value: 'indent', disabled: false },
{ type: 'push', label: 'Outdent', value: 'outdent', disabled: true },
{ type: 'push', label: 'Create an Unordered List', value: 'insertunorderedlist' }
]
},
{ type: 'separator' },
{ group: 'insertitem',
buttons: [
{ type: 'push', label: 'HTML Link CTRL + SHIFT + L', value: 'createlink', disabled: true
},
{ type: 'push', label: 'Insert Image', value: 'insertimage' }
]
}
]
}
};

var titleConfig = {
handleSubmit: true,
height: '80px',
width: '500px',
animate: true,
limitCommands: true,
toolbar: {
titlebar: 'Title',
collapse: true,
buttons: [
{ group: 'textstyle',
buttons: [
{ type: 'push', label: 'Bold', value: 'bold' },
{ type: 'push', label: 'Italic', value: 'italic' },
{ type: 'push', label: 'Underline', value: 'underline' },
{ type: 'separator' },
{ type: 'spin', label: '12', value: 'fontsize', range: [ 9, 75 ], disabled: true },
{ type: 'color', label: 'Font Color', value: 'forecolor', disabled: true }
]
}
]
}
};

var descriptionEditor = new YAHOO.widget.Editor('ev_desc', descriptionConfig);
descriptionEditor.render();
var titleEditor = new YAHOO.widget.Editor('ev_title', titleConfig);
titleEditor.render();


function getTitle(){
//Put the HTML back into the text area
titleEditor.saveHTML();
//The var description_html will now have the contents of the textarea
var title_html = titleEditor.get('ev_title').value;
document.write(";<div>;title html: " + title_html + "</div>&quot;);
return title_html;
}
function getDescription(){
descriptionEditor.saveHTML();
//The var description_html will now have the contents of the textarea
var description_html = descriptionEditor.get('descritpionEditor').value;
return description_html;
}

function submitForm(){
document.getElementById('event_form').submit();
}




__._,_.___
.

__,_._,___
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )