I'm trying to bring a custom view to an active admins page.
But thing is whenever I try to put a text area field it automatically produces a custom text area field where I can set font and all, something like word editor as shown in picture.
Is there a way I can prevent this and get normal text editor?
Yes. TinyMCE lets you specify a html class that prevents it from activating. Text fields with that class will not get transformed into the editor.
http://www.tinymce.com/wiki.php/Configuration3x:editor_deselector
Where you initialize TinyMCE, add these options:
tinyMCE.init({
//your init code
editor_deselector: 'selector', //replace this with the HTML class of your choice
//more of your init code
});
Any text area that has the specified class will not get transformed into an editor.
Related
In case of error, I need to change the text of TextField to var(--lumo-error-text-color)
I tried the following:
textField.getStyle().set("color", "var(--lumo-error-text-color)");
but it doesn't work. How to properly change the text color of TextField component?
That does work just fine for me. However, assuming you want all TextFields to have red text when they're invalid, that really would be more appropriate to handle in CSS: Just add the following block to your styles.css:
vaadin-text-field[invalid]::part(input-field) {
color: var(--lumo-error-text-color);
}
Or, if you want that across all text input fields, skip the element name:
[invalid]::part(input-field) {
color: var(--lumo-error-text-color);
}
Since the text field is slotted, I don't believe you can set it's color property inline. You can add/remove a class name and use the method suggested above. Just have one class set the text to error color and the other class set it back to the regular color.
There's this Vaadin 14 TextField created with field = new TextField(...); field.setLabel("Phone number"); like this:
I'd like to add an interactive info icon into that label like this:
When a user clicks (or touches) at the info icon then the system should show a popup or dialogue with some additional information (formated text and images).
I tried to add some HTML and JavaScript like this: field.setLabel("Phone number <span onclick='...'>?</span>"); but the browser just shows exactly that technical String with all its tags and so on.
I already set tooltips with field.getElement().setAttribute("title", "Some information"); but without formatting this is not fancy for longer text and as far as I know not usable for images.
field.setHelperText(...) also is not what I'm looking for because it shows the text durably and not just at a click/touch.
Is there a Vaadin way to achieve that interactive info icon? Otherwise I would to try it with JavaScript and CSS (querying the label element and adding hidden children to the TextField and show them when hovering the label like in this example https://www.scriptol.com/css/tooltip.php ).
Source of the question mark: vaadin:info-circle-o (https://vaadin.com/components/vaadin-icons/html-examples)
The "problem" with the label on fields as of 14.6 is, that it is just an
property on the element and while it ends up as the content of
a <label> tag, you can not provide anything but text.
One alternative would be using a FormLayout where you may provide
a component as label and therefor you can provide "whatever you want".
E.g. use an icon and add a title attribute to get some simple tool-tip
from the browser:
new FormLayout().tap{
addFormItem( // XXX
new TextField(),
new Span(
new Text("The Label"),
VaadinIcon.QUESTION_CIRCLE.create().tap{
setSize('12px')
setColor('blue')
element.tap{
setAttribute("title", "The Help")
style.tap{
set('padding-left', '4px')
}
}
}
)
)
}
I would like to show a formatted message with bold and normal font. Something like
lili lala lolo
Is it possible to do something like this with messageDLG or similar api ?
This question has somewhat already been answered here. They propose several solution, one of them I like is using a HTML label from jVCL. This component is JvHTLabel.
Using the HTML label, you can easily create a form with that label centered and a class method to create the form, set a caption, set the label text using simple HTML markup, show the form modal until the user click on OK/Cancel button you'll add as well.
For the JqueryUI tag-it widget, I'd like to completely prevent the new extra text entry field from appearing. I'm pre-populating with existing tags, and I'd just like to allow people to delete tags but not enter them.
I can make the new field read-only, but the field remains visible in IE and in both IE and Firefox clicking in the area of the widget causes the cursor to focus on that field.
What I'd like to do is get rid of the extra input field altogether.
There doesn't seem to be a tagit property for this associated with the .tagit() method. Is there something else I can do to prevent the extra field from being created?
Thanks,
doug
Try this:
$('#tagit').tagit({
//options
}).ready(function() {
$(this).find('.tagit-new').css('height', '13px').empty();
});
Using firebug we can see that the input field created by tagit is in a li element with class tagit-new. We need to set the height otherwise the tag container will squash to a slither when the last tag is deleted, and then we can empty() this to get rid of the tag input field.
I have a text area that has names within the default value. For example the textarea reads..
(dynamic registrant name) just registered to become
a donor in (dynamic from pull-down above)
honor. This text is editable
So in the same form I have an input that asks the user for their name and a select box where they can choose among a selections of names. I am trying to change the names within the text area based on the values they enter in the input and drop-down fields above the text area. Can someone help with this? I am completely stuck. I have read through some of the forums here and it looks like a lot of the solutions are to use ajax. I have zero experience in ajax and would like to find a solution that does not use that...is it possible? Or could someone help with a solution?
I don't think textarea is what you want exactly. What if the user takes off the (dynamic from pull-down above) part? How would you know where to put the text at? Even if you somehow could, I suggest you make regular text input elements for contents that the user can change and put the other dynamically changing text as uneditable html text elements (or however you want to format them).