Adding CKEditor through javascript onclick event adds a CKEditor to the DOM but does not allow me to enter text into it. Why? - wysiwyg

I'm adding a ckeditor to my form using the onclick functionality - i.e., when the user clicks a button, the ckeditor is added to the form.
I'm echoing out the html generated when a ckeditor is added to a page through the javascript function.
The ckeditor is added, but the text area cannot be modified.
is it because i'm adding the html to generate the ckeditor as :
ckeditor.innerHTML = '......';
is there another way to add a ckeditor to my form using the javascript onclick (like: onclick="addCKEditor();")
Thanks!

using CKEDITOR.replace('id) after adding the textarea to the DOM - within the javascript function, got the job done.

Related

How to build a multistep Drupal 7 form with a Bootstrap popup?

I have a multistep Drupal 7 form. I'd like to show it in a Bootstrap Popup.
This form works fine on a normal page however when I put it into a Bootstrap popup it closes the popup when the first button is pressed.
I use drupal_render(drupal_get_form('MYFORMNAME_form')) to put the form into the popup body.
How can I make this multistep form work properly in the popup?
when you say bootstrap popup, do you mean a modal window (http://getbootstrap.com/javascript/#modals)? Modals in bootstrap are defined inside the body of the page and just hidden/shown as needed. If you want one to act as its own window, you need an iframe in it, because submitting the form will not trigger whatever mechanism you put in place to show the modal dialog in the first place.
Another option is to use code to re-show the modal, with the form at whatever stage it is at, with each page load (next button, etc.)
A last option is to do all of the form navigation via AJAX. Then you don't ever need to put the form inside an iframe nor include code to re-show the modal with each submission of the form, since the page never gets refreshed.
IMHO the iframe is easiest, and a decent option if you don't have any qualms about iframes. You just need to place the form in a separate page and include it inside the iframe. Some theming work will enable you to turn off the normal page chrome that will make your modal look like a miniature version of your site -- you probably don't want your header, navbar, footer, etc. inside the modal.
You could use the Popup forms module. It claims:
Works well with multi-step forms. Just don't add [the] "Next" button id to
[the] 'close_buttons' array to keep [the] popup open [when navigating between steps].
This solution is not using a Boostrap Modal ("Bootstrap popup") though rather a jQuery UI dialog. It requires a bit of custom coding to use this module. Example code is provided on the project page.

How to add a custom button in rte plugin in aem/cq

How to add a custom button in rte plugin/cq?
The below path is for hyperlink
/apps/cq/ui/widgets/source/widgets/form/rte/plugins/LinkDialog.js
I need to add a custom button in rte plugin to extend the hyperlink functionality?
To provide a new button/plugin in RTE, a new clientlib will have to be created. In the js file, the intended functionality of button can be implemented in ExtJs. In CSS file, the appearance/image of thee button can be specified.
Then the newly created clientlib can be registered as a plugin for RTE by using following line :
CUI.rte.plugins.PluginRegistry.register("pluginName",ClientlibName.PluginName.Plugin);
The entire process has been described step by step in this excellent article.

use one text box with multiple form submit buttons ruby on rails

I'm making an app where I have multiple forms on one page but they are all similar; there is a text box and a submit button.
What I would like to do is consolidate all text boxes into one then have many submit buttons. That way the user inputs the data once in the obvious text box at top then decides which category (submit button) he would like to apply the data in the input box to.
Is this possible? I can't find and documentation on how to do this. Thanks!
You can do so by using <%= fomr_tag url: "/myCust" do %> method to create a form and wrap all the fields inside form tag. on submit button you will be redirect to /myCust method.
There you can get all the params in myCust method. You are using rails 4 then define all params under private method as it does. Store each of them. as you may want.

how to post/submit form values on textbox focus out event in asp.net mvc2 with out Jquery?

I have two text boxes using Html.TextboxFor() helper. When I type values in Textbox1 and click outside (moving out the cursor from the textbox), TextBox2 should be populated with TextBox2.
I am aware of that using Javascript/Jquery, fill the values, but i don't an option use any of the client side script.
So I have to post the form values to controller action method & fill Textbox1 values with TextBox2 using model object.
how to post/submit form values on textbox focus out event in asp.net mvc2 with out Jquery?
how to post/submit form values on textbox focus out event in asp.net mvc2 with out Jquery?
Perfectly impossible without javascript. You need to subscribe to the onchange event of the first textbox and then trigger the form submission (once again using javascript).
If you cannot use javascript, your only option is to have a submit button on the form that the will submit the form and the corresponding text values once the user clicks on it.

Tinymce adding text with button

I'm trying to implement a button outside of the TinyMce editor, that would add text to the active editor upon clicking.
How can I do this?
(For example: There's a button on my website that should add "Test" into the editor, but it doesn't).
Thanks for help :)
Add this code to the onClick of your button:
// the editor id is the same id of your textarea, default "content" in case your textarea does not have an id
tinymce.get('your_editor_id').execCommand('mceInsertContent', false, "Test");
In case you have one single editor on your page you may also use tinymce.activeEditor instead of tinymce.get('your_editor_id').