Link to home
Start Free TrialLog in
Avatar of fgict
fgict

asked on

Hide input html code (for hyperlinks) in textarea

I have a need to hide input html code (for hyperlinks) in textarea field so that the only data that a user can input into the textarea is either plain text or select a hyperlink from a dropdown list above the textarea. I do not wish to post the code like:
(the <a href="www.test.com">Test</a> website.) I just wish the end user to see (the Test website) in the textarea code with "Test" word as a hyperlink.

I do not wish to turn the textarea into a full editor either. The Code at present is like..

<body bgcolor="#FFFFFF" text="#000000">
<select name="hyperlinks">
  <option value="">Select a Link</option>
  <option value="http://www.test1.com">Test1</option>
  <option value="http://www.test2.com">Test2</option>
</select>
<form name="form1">
  <textarea cols="50" rows="10" name="message"></textarea></form>
</body>

Be grateful for any assistance :)
Avatar of fritz_the_blank
fritz_the_blank
Flag of United States of America image

I don't understand the question. Let's break it down:

1) if the user selects an item from the select list, the display text (not the value) should appear in the text area
2) the user should be able to type the display text (not an actual URL) into the text area

Is this much correct? Also, can the user type anything else into the text area, i.e., some text that is not present as the display text of your select list?

FtB
Avatar of fgict
fgict

ASKER

Hi FtB

Points 1 & 2 are correct.
I only wish to allow the user type text into the textarea box.. and to input a hyperlink they must select a from dropdown list to populate the textarea box. Hope this explains my problem alittle better.

fgict
I am afraid it doesn't. Let me ask this another way--what if the user wants to type the word "Cow" into the text area. Is that allowed?

FtB
Avatar of fgict

ASKER

ok..

Yes every text is basically allowed in textarea field.. but when user wants to create a hyperlink they should choose this from the dropdown menu.
The textarea field will not show e.g. <a href="http://www.test.com>Test</a> but it will only show word Test (but the hyperlink code will be saved to database from textarea when user clicks "Submit" button)

:)
Okay, I get it now. This is sort of possible, but what will have to happen is that when the user submits the form, we will have to replace the text Test1 Test2 and etc. with the actual URLs. Perhaps we can even do this server-side?

FtB
Avatar of fgict

ASKER

yes i would imagine doing a replace keywords against their hyperlink values in list before saving them would be possible in asp..somehow..
ASKER CERTIFIED SOLUTION
Avatar of fritz_the_blank
fritz_the_blank
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of fgict

ASKER

ok it's populating the Link name.. now we need to populate the link name and value as hyperlink.. then conceal it in textarea so it only shows link name..
No no no!!! That is what we discussed above! You will have to grab the name and do a replace with server-side code once the form is submitted, i.e."

strMessage = Request.Form("message")

strMessage = Replace(strMessage, "Test1", "<a href ='http://www.test1.com'>Test1</a>")
strMessage = Replace(strMessage, "Test2", "<a href ='http://www.test2.com'>Test2</a>")

FtB
So, how is this working?

FtB
Avatar of fgict

ASKER

Sorry.. still working on it.. have to get back to you after w/e if that is ok
That's fine. I just wanted to make sure that you had everything you needed as I won't be around so much.

Good luck!

FtB