Add a radio button in RichTextArea

93 views
Skip to first unread message

Andrei

unread,
Oct 2, 2012, 10:38:33 AM10/2/12
to google-we...@googlegroups.com
You can't insert widgets inside the RTA. You should use an RTA formatter to insert HTML that renders a radio button.

jimakos17

unread,
Oct 3, 2012, 7:06:21 AM10/3/12
to google-we...@googlegroups.com
Well, I did this
                   if(event.getCharCode()=='*')
                    {          
                        rta.setHTML("<input type=radio name=name value=1>");
                    }
it creates a radiobutton which is clickable in Chrome, but it isn't in Firefox and IE.
rta is my RichTextArea, is declared as: private final RichTextArea rta = new RichTextArea();

I got rta formatters: final BasicFormatter bf = rta.getBasicFormatter();
                             final ExtendedFormatter ef = rta.getExtendedFormatter();
but neither bf nor ef provide me the setHTML method in order to create a radiobutton.

Please help me with this, I have spent a week on that and I haven't done it yet.
Thank you in advance!!!

Andrei

unread,
Oct 3, 2012, 10:51:25 AM10/3/12
to google-we...@googlegroups.com
Use .insertHTML() method with your formatter.

You need to insert valid HTML. Your HTML does not have quotes around values. When you add quotation marks, you need to escape them, of course.

jimakos17

unread,
Oct 4, 2012, 5:54:57 AM10/4/12
to google-we...@googlegroups.com
final RichTextArea.Formatter rtaf= rta.getFormatter();

rtaf.insertHTML("<input type=\"radio\" name=\"name\" value=\"1\">");

but the problem is still there. It is not clickable in the Firefox and IE.
In Chrome works fine.
Andrei thank you sooo much for your replies!!!

jimakos17

unread,
Oct 4, 2012, 7:27:29 AM10/4/12
to google-we...@googlegroups.com
rtaf.insertHTML("<div contenteditable = \"false\"> <form><input type=\"radio\" name=\"group1\" value=\"1\"></form></div>");

in that way it works in Chrome and IE but there is still a problem with Firefox.
Thank you in advance!!!
Reply all
Reply to author
Forward
0 new messages