Asapplease Asapplease - 3 months ago 14
HTTP Question

HTTP Error 405.0 while saving content in TinyMCE

I wonder why, while saving content in TinyMCE:s editor, I always get the error "HTTP Error 405.0 - Method Not Allowed
The page you are looking for cannot be displayed because an invalid method (HTTP verb) is being used." Here is my code:

HTML:

<form method="get">
<textarea id="mytextarea">This is an implementation of TinyMCE in an Angular application.</textarea>
<button name="submitbtn"></button>
</form>


JavaScript:

tinymce.init({
selector: '#mytextarea',
plugins: [
"advlist autolink lists link image charmap print preview anchor", // tillägg av plugins line fick
"searchreplace visualblocks code fullscreen", // Insert, Table och Tools menyer att dyka upp
"insertdatetime media table contextmenu paste",
"save", /*HTTP Error 405.0 - Method Not Allowed
The page you are looking for cannot be displayed because an invalid method (HTTP verb) is being used.*/

//'codemirror'
],
toolbar: 'insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | code | save'
});


Thanks in advance!

Best Regards, Attila

Answer

While a form can be submitted using the GET method, a form should (in general) be submitted using HTTP POST (not GET). For example:

<form method="post" action="URLToSendFileTo.php">
...
</form> 

(Submitting using GET has limitations in the amount of content you can submit and the form content becomes part of the URL which can be undesired in many situations)

When using the form tag you need to provide an action attribute so the page knows to where it should post the information.

This page provides more details on the <form> tag and its options: http://www.w3schools.com/tags/att_form_method.asp

As a side note ... there are 5 basic HTTP Verbs that you may need to use in your development. A brief overview of how each are generally used can be found here:

http://www.restapitutorial.com/lessons/httpmethods.html

Comments