I have Problems with Ckeditor in Symfony2 - symfony

in my template i have:
<form>
<textarea name="editor1" id="editor1" rows="10" cols="80">
This is my textarea to be replaced with CKEditor.
</textarea>
<script>
// Replace the <textarea id="editor1"> with a CKEditor
// instance, using default configuration.
CKEDITOR.replace('editor1', { toolbar : [ ['Bold','Italic','Font','FontSize'] ] });
</script>
</form>
and the result is this:
localhost/PeopleSymfony/web/app_dev.php/index/config.js?t=G4CD Failed to load resource: the server responded with a status of 500 (Internal Server Error)
7391ff2_ckeditor_5.js:85
GET http://localhost/PeopleSymfony/web/app_dev.php/index/lang/es.js?t=G4CD http://localhost/PeopleSymfony/web/app_dev.php/index/skins/moono/
i dont know to how solve.
i did php app/console assets:install to reinstalle assets but have the same error
why search es.js in
//localhost/PeopleSymfony/web/app_dev.php/index/lang/es.js?t=G4CD and no in the bundle ivoryckeditor?

Related

Using Jquery-fileupload plugin without the <form> tag?

I'm trying to integrate Jquery File Upload plugin in my aspx page (asp.net website). I followed the guide, including all required scripts and stylesheets, but in the index.html it's used a form tag to initialize the plugin and with the tag are also specified action and method attributes. Since I'm using asp.net, I am not allowed to insert the form tag because asp.net wrap the whole website with another form tag and it doesn't allow to insert another form tag inside it.
How can I initialize the plugin in a different way?
You don't actually have to have a form to use jQuery file upload plugin. Because the plugin is using jQuery ajax under the hood. use the bellow code inside your page, keep in mind you have to code an API on the server side.
$(function () {
'use strict';
// Change this to the location of your server-side upload handler:
var url = 'your server api or handler';
$('#fileupload').fileupload({
url: url,
dataType: 'json',
done: function (e, data) {
$.each(data.result.files, function (index, file) {
$('<p/>').text(file.name).appendTo('#files');
});
},
progressall: function (e, data) {
var progress = parseInt(data.loaded / data.total * 100, 10);
$('#progress .progress-bar').css(
'width',
progress + '%'
);
}
}).prop('disabled', !$.support.fileInput)
.parent().addClass($.support.fileInput ? undefined : 'disabled');
});
and your html as follows:
<span class="btn btn-success fileinput-button">
<i class="glyphicon glyphicon-plus"></i>
<span>Select files...</span>
<!-- The file input field used as target for the file upload widget -->
<input id="fileupload" type="file" name="files[]" multiple>
</span>
<br>
<br>
<!-- The global progress bar -->
<div id="progress" class="progress">
<div class="progress-bar progress-bar-success"></div>
</div>
<!-- The container for the uploaded files -->
<div id="files" class="files"></div>

Ckeditor in Symfony2

in my template i have:
<form>
<textarea name="editor1" id="editor1" rows="10" cols="80">
This is my textarea to be replaced with CKEditor.
</textarea>
<script>
// Replace the <textarea id="editor1"> with a CKEditor
// instance, using default configuration.
CKEDITOR.replace('editor1', { toolbar : [ ['Bold','Italic','Font','FontSize'] ] });
</script>
</form>
and the result is this:
localhost/PeopleSymfony/web/app_dev.php/index/config.js?t=G4CD Failed to load resource: the server responded with a status of 500 (Internal Server Error)
7391ff2_ckeditor_5.js:85
GET http://localhost/PeopleSymfony/web/app_dev.php/index/lang/es.js?t=G4CD http://localhost/PeopleSymfony/web/app_dev.php/index/skins/moono/
i dont know to how solve.
i did php app/console assets:install to reinstalle assets but have the same error
why search es.js in
//localhost/PeopleSymfony/web/app_dev.php/index/lang/es.js?t=G4CD and no in the bundle ivoryckeditor?

Using CKEditor with Meteor

I'm trying to use CKEditor with meteor.
First I added the package
https://libraries.io/meteor/lsun:ckeditor
Then I added the following code:
route.js
Router.route('/editor', function () {
this.render('editor');
});
editor.html
<template name="editor">
<form>
<textarea name="editor1" id="editor1" rows="10" cols="80">
This is my textarea to be replaced with CKEditor.
</textarea>
</form>
</template>
helpers.js
Template.editor.rendered = function() {
CKEDITOR.replace( 'editor1' );
};
Now when I browse to my /editor route, I can see the ckeditor being loaded initially. However, if I press F5 while I am on the page, then I start getting the plain textarea, without ckeditor replacing it with the editor. Also, I get the following error in the javascript console:
Exception from Tracker afterFlush function:
meteor.js:888
ReferenceError: CKEDITOR is not defined
at Template.editor.rendered (helpers.js:10)
at blaze.js:3338
at Function.Template._withTemplateInstanceFunc (blaze.js:3679)
at fireCallbacks (blaze.js:3334)
at null.<anonymous> (blaze.js:3427)
at blaze.js:1788
at Object.Blaze._withCurrentView (blaze.js:2219)
at blaze.js:1787
at Object.Tracker._runFlush (tracker.js:531)
at onGlobalMessage (meteor.js:373)

Not able to post form in Adode CQ5

I am a newbie in AdobeCQ5. I am facing some trouble in posting form. Here is my Structure -
/apps/<myproject>/components/mytestcomponent
mytestcomopnent.jsp has following code -
<form id="myForm" action="<%=resource.getPath()+".html" %>">
<input type="text" id="t1" class="input-small" placeholder="Temprature F" />
<input type="text" id="t2" class="input-small" placeholder="Temprature C" readonly/>
<button type="button" id="cbtn" class="btn">Convert</button>
</form>
<script>
$(document).ready(function() {
$('#cbtn').click(function () {
var URL = $("#myForm").attr("action");
alert(URL);
var t1=$("#t1").val();
var t2=$("#t2").val();
$.ajax({
url: URL,
data:{'t1':t1},
type:"post",
success: function(data, status) {
$("#t2").val(data);
},
error: function( xhr, txtStat, errThrown ) {
alert("ajax error! " + txtStat + ":::" + errThrown);
}
});
});
});
</script>
This is giving my response code 200 (Success) but the output is not desired. My mycomponent.POST.jsp has following code -
<%
// TODO add you code here
String t1=request.getParameter("t1");
%>
<%= t1 %>
It gives the following output
Content modified /content/imobile/en/jcr:content/social.html
Status
200
Message
OK
Location /content/imobile/en/_jcr_content/social.html
Parent Location /content/imobile/en/_jcr_content
Path
/content/imobile/en/jcr:content/social.html
Referer http://example.comt:4502/content/imobile/en.html
ChangeLog
<pre></pre>
Go Back
Modified Resource
Parent of Modified Resource
Please help to resolve this.
The JSP file handling the POST method for your component should be named POST.jsp rather than mycomponent.POST.jsp.
Please notice that if you intercept all POST requests to your component, you won't be able to edit it on the author instance using a dialog (as the dialog simply POSTs data to the component URL). To avoid it, consider using a custom selector (like form). Your form should look be declared like this:
<form id="myForm" action="${resource.path}.form.html">
and the script handling POST request should be called form.POST.jsp.
The second important thing is that you should use Java classes rather than JSP files to store business logic. In this case it means that the form.POST.jsp script can be replaced with a Sling servlet declared as follows:
#SlingServlet(
resourceTypes="myproject/components/mytestcomponent",
methods="POST",
selectors="form")

How to call aspx page without opening it

I have a aspx page that I need to call without going directly on that page.
I have tried to make POST from form but it opens this action url in browser.
<form method="POST" action="http://mysite/actionpage.aspx">
<input type="submit" value="Submit" />
</form>
You could use curl if you're on a *nix system.
Here is a reference on how to post data to a page. The result will be returned through the command line.
What is the curl command line syntax to do a post request?
Here is the syntax for reference:
curl -d "param1=value1&param2=value2" http://example.com/resource.cgi
or
curl -F "fileupload=#filename.txt" http://example.com/resource.cgi
If jQuery is allowed to use in your case, You may use jQuery ajax to call that page
$("form").submit(function(e){
e.preventDefault();
$.post("yoursecondpage",function(data){
//do whatever with the response from that page
});
});
You can do it via ajax.
For example, if you add a script reference to jQuery things will get much easier, and you can do the following:
<script type="text/javascript">
function postIt()
{
$.post(
"http://mysite/actionpage.aspx"
, function(data)
{
// data was returned from the server
alert("data posted in the background");
} );
}
</script>
The processing you be done via background.
Your final HTML woul be :
<form method="POST" action="http://mysite/actionpage.aspx">
<input type="submit" value="Submit" onclick="postIt();" />
</form>
I haven't tested , but looks like you are navigating to .aspx means server page, i.e. you need to use runat="Server" in your tags like this

Resources