Page 1 of 2
How to make the hyper links clicable in rich Text field
Posted: Fri Feb 22, 2008 12:52 pm
by pkmittal
Hello,
I have a few paragraphs in word document. Those paragraphs have couple of urls with rich text.
I copied those paragraphs in a rich text field but then the urls are not clickbale. Any idea how those urls can become clickable?
Another question is: I have a paragraph which contains a table and one image? How can I show that rich text pargaph with images and table in rev?? I have seen that when we copy that paragraph to rich text field then table and image do not get copied. Any idea what can be done to solve this issue?
thanks for your help
Best Regards
Pradeep
Posted: Fri Feb 22, 2008 1:28 pm
by Janschenkel
Hi Pradeep,
You cannot use tables inside a text field - images should work, as long as they're not inside a table, though.
If you want URL's to work, you'll need to set the 'lockText' property of the field to false (otherwise no events are triggered) and you'll have to handle the 'linkClicked' event.
Set the script of your field to something like:
Code: Select all
on linkClicked theLink
launch URL theLink
end linkClicked
Hope this helped,
Jan Schenkel.
Posted: Fri Feb 22, 2008 1:44 pm
by pkmittal
Thanks Jan.
When I try the things, that after clicking on the link nothing happens.
It seems that when I past the hyperlink to rich text fields, it seems to get converted as as an underline text not the hyperlinks.
Any idea?
Posted: Fri Feb 22, 2008 3:03 pm
by Mark
Hi Pradeep,
I think Jan meant:
Code: Select all
on linkClicked theLink
revGoUrl URL theLink
end linkClicked
You might want to use an if-statement to check that theLink contains a valid URL.
Best,
Mark
Posted: Fri Feb 22, 2008 3:59 pm
by pkmittal
Marc,
Yes I used revGoURL but link handler does not get triggerd. I have removed the loctext of field. ( put that link handler code in the script of the field)
It does not look like like also
any idea?
Posted: Fri Feb 22, 2008 4:06 pm
by Mark
Hi Pradeep,
It looks like Revolution doesn't recognise the links and RTF doesn't have a "linked" or "grouped" style. The link you are copying is entered into the field as coloured, underlined text. Probably, you need to parse the text to recognise all links in it and set the textStyle of a text chunk to link if it appears to be a link. Sorry.
Mark
How to Get Link Value using clickChunk
Posted: Wed Feb 27, 2008 6:31 am
by pkmittal
Hey mark, thanks for your reply.
since the content will be genereated dynamically in the field and it will have many different hyperlinks. So I am not sure for which dynamic text I should set the textStyle to link.
I thought of using clickChunk (
put the value of the clickChunk) But since the url is sepereated by puncutation so it does not give complete text.
for example if the url contains
www.google.com then using clickChunk I recieve only www or . or google etc. Is there any way to ignore puncutation so that the clickchunk can give me complete url address ??
thanks for your insights.
Problem with LinkClicked Handler
Posted: Wed Jun 11, 2008 8:06 am
by pkmittal
Hello ,
When I am trying the following code, it does not seeems to work
Code: Select all
on linkClicked theLink
revGoUrl URL theLink
end linkClicked
I am adding this code in the Text Field script, I have locked the field and also have locked the test but linkClicked function does not seems to be triggered.
Please let me know if you have any idea.
Thanks
Pradeep
Posted: Wed Jun 11, 2008 9:46 am
by Mark
Hi Pradeep,
The correct command is
revGoUrl <url>
Have a look at the examples in the docs.
Best,
Mark
Posted: Wed Jun 11, 2008 10:06 am
by pkmittal
Thanks Mark,
I corrected the command. but the problem is , it does not come to that handler itself.
I have a text filed. Inside that I have some text. Here is an HTML text of that field
Code: Select all
<p><a name="http://www.google.com/">www.google.com</a></p>
But when I click on the link in the text field that it does not seems to recognize it as a link and neither goes to the handler below which is defined in the text Field.
Code: Select all
on linkClicked theLink
answer "Hello"
revGoURL "http://www.google.com"
revGoURL theLink
end linkClicked
The field is locked and also the text have been locked. I tried different combinations but it does not work.
Any Insights or sample stack where I can see it working?
Thanks
Best Regards
Pradeep
Posted: Wed Jun 11, 2008 10:55 am
by Tim
Hi there,
I've just been playing around with this and found the following will work and get you started :
1. Create a new stack
2. Put a field on the stack
3. Enter some text into the field (for example "visit google")
4. Set the lockText of the field to true
5. Add the following handler to the fields script
on linkClicked theText
if theText is not empty then revGoURL theText
end linkClicked
6. In the message box issue the following 2 commands
set the linkText of line 1 of field 1 to "
www.google.com"
set the textStyle of line 1 of field 1 to link
Now when you click the link, you will be taken to google.com
Hope this gives you a working base to start from
Regards,
Tim.
Posted: Wed Jun 11, 2008 12:10 pm
by Mark
Pradeep,
"name" has to be "href"
Where did you get your htmlCode?!
Mark
Posted: Wed Jun 11, 2008 12:20 pm
by pkmittal
I am not creating this html code.
When I say, put the html of field "xyz" then it gives me that html format
Posted: Wed Jun 11, 2008 12:23 pm
by Mark
Dear Pradeep,
How did you create/set/magically produce the text?
Mark
Posted: Wed Jun 11, 2008 12:28 pm
by pkmittal
To create the text in the text field,
I just typed the
www.google.com in the content section of text field.
And then I set the Link Text of field like this
Code: Select all
set the linkText of line 1 of field "test" to "http://www.google.com/"
And to know what It has set , I used,
I hope this is the information you are asking for.