Actionscript: how to add a link text to text area - actionscript

I have a text area displaying something, I want to achieve:
some words are rendered as hyperlink in html(blue color with underline), and when mouse hovers there it becomes a hand. When user clicks it, it will invoke a function in AS and pass the words to the callback function.
Is it doable?
Thanks.

You can do this with a Text Area by setting its "htmlText" property, rather than "text".
<mx:Script>
<![CDATA[
[Bindable] private var content:String = "<a href='http://www.google.com'>Click for Google</a>";
]]>
</mx:Script>
<mx:TextArea id="htmlDisplay" htmlText="{content}" />
You can use other tags to format the link however you want.

Related

Vaadin 14: tooltip at Textfield label with icon, text and image

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')
}
}
}
)
)
}

Jquery Drag and drop to specific text

I have a text string in my grid in follwoing format
Pawan/tiwari/idof22/vf
i want to implement drag and drop of this string in textbox.
but how can i determine which substring was clicked
suppose if user click on tiwari and drop it in text box then only tiwari will be in textbox.
Thanks
Yes I got answere of my question.
I have created span tag dynamically but this span tag is not draggable so when i am genrating this span tag i also call $('cssclass').draggable() function now it's working.

Pre written text into textarea

I want to make text area, where always is pre written text, and that piece of text is located at the end, and it wouldn't be possible to delete. For example, you write answer here, and at the end, right side of cursor, is text "This is end of my answer".
And when you POST it, it displays your written text and "This is end of my answer" at the end.
I know, that I can attach this text easily after posting it, but it must be displayed, and anyone could see it.
I need javascript/jQuery solution.
Thanks!
The text to the right side of the cursor, that moves as you type is really annoying and zero-usable. However, if you want something like that I would suggest putting a background image on the textarea with the text you want. It will be static and none will be able to edit it, and at the same time will always see it.
<input class="myinput" name="myinput" type="text" value="Text_Ends_Here" /></input>​​
$("input[name=myinput]").click(function()
{
var currentValue = $(this).val();
currentValue = currentValue.replace("Text_Ends_Here", "");
$(this).val(currentValue);
}
);
$("input[name=myinput]").focusout(function()
{
var currentValue = $(this).val();
$(this).val(currentValue + ' Text_Ends_Here');
}
);​
http://jsfiddle.net/gXvLB/95/
You can position the required text over textarea using positioning.

Disable tooltip on some elements even when title is defined

Is there a way not to show a tooltip when the title of an element is defined ?
Im using huddletogether's LightBox2 which takes whatever is in the anchor's title and converts into HTML.
http://www.huddletogether.com/projects/lightbox2/#support
Can I insert links in the caption?
Im calling a javascript function in that link and that tooltip shows this when the mouse hovers the image.
Click
Other option is to change return [anchor.href, anchor.title]; to something like return [anchor.href, anchor.aTitle]; as mentioned here.

I have one Textbox and inside the textbox i want the text which user cannot be deleted

i have one text box in which the text inside the text box should not be deleted and after the text only the cursor has to be placed
Ex:
For the textbox: "http://" should be available and the text which is in quotations cannot be deleted inside the textbox and the cursor should be after the quotations.
Thanks in advance,
Vara Prasad.M
add this to the input field:
onchange="testEdit(this)"
and have a javascript function that does something like this:
function testEdit(field) {
if (field.value.substring(0, 8) != "http://") {
field.value = "http://" + field.value.substring(8);
}
}
However, this is sloppy. The best way is to put the http:// in a label OUTSIDE the text box. If something is in a text box, it should be input. By putting that inside the text box, you will be confusing your users.
Good luck.

Resources