How can you put text from a file into a textarea box, when the file is selected from a Select list!

S

Shaiboy_UK

Hi All,

Hope someone can help here!!

I'm putting a standard mail page together, that will allow my users to
sent templete emails out to people. The files are stored in text
files. I have come up with a script to produce the names into a
Select list, but know i'm wanting them to be read into a textarea box,
to allow me to submit them into from the form into the sendmail.asp
page! but the only way i can pass them out, is into a iframe, which
doesn't seem to allow me to then pass them into the sendmail.asp page
for sending.

Anyone help?

Cheers
Shaiboy
(e-mail address removed)
 
R

Ray Costanzo [MVP]

Are the files on the server?

Here's a simple method where the page posts back to itself, and there are
two files in the same directory on the server named file1.txt and file2.txt.

<%
Dim sFile
sFile = Request.Form("cboFile")
%>

<body>
<form method="post" action="self.asp">
<select name="cboFile" onchange="this.form.submit();">
<option value="file1.txt"<% If sFile = "file1.txt" Then Response.Write "
selected=""selected"""%>>File 1</option>
<option value="file2.txt"<% If sFile = "file2.txt" Then Response.Write "
selected=""selected"""%>>File 2</option>
</select>
<textarea><%If sFile <> "" Then Server.Execute sFile%></textarea>
<input type="submit" />
</form>

Ray at work
 
S

Shaiboy_UK

Ray Costanzo said:
Are the files on the server?

Here's a simple method where the page posts back to itself, and there are
two files in the same directory on the server named file1.txt and
file2.txt.

<%
Dim sFile
sFile = Request.Form("cboFile")
%>

<body>
<form method="post" action="self.asp">
<select name="cboFile" onchange="this.form.submit();">
<option value="file1.txt"<% If sFile = "file1.txt" Then Response.Write
"
selected=""selected"""%>>File 1</option>
<option value="file2.txt"<% If sFile = "file2.txt" Then Response.Write
"
selected=""selected"""%>>File 2</option>
</select>
<textarea><%If sFile <> "" Then Server.Execute sFile%></textarea>
<input type="submit" />
</form>

Ray at work

Hi Ray,

Tried and doesn't work, script at:
http://www.theukserver.net/testscript/test2.asp
files all listed at http://www.theukserver.net/testscript/

Let me know

Cheers
Shaiboy
(e-mail address removed)
 
R

Ray Costanzo [MVP]

What "doesn't work" about it? You don't have any file names listed in the
dropdown for one thing. Also, the form does not post back to itself.

Ray at work
 
S

Shaiboy_UK

Ray Costanzo said:
What "doesn't work" about it? You don't have any file names listed in the
dropdown for one thing. Also, the form does not post back to itself.

Ray at work

Hi

I used the script that you gave!!!

Cheers
Shaiboy
(e-mail address removed)
 
R

Ray Costanzo [MVP]

No, not quite. View your source and you'll see that you're missing a " and
a space.

Ray at home
 
S

Shaiboy_UK

Ray Costanzo said:
No, not quite. View your source and you'll see that you're missing a "
and a space.

Ray at home

Missing a " and a space? where? checked the code and was missing a >
You code wouldn't work with the extra " in it!!!

Cheers
Shaiboy
(e-mail address removed)
 
S

Shaiboy_UK

Ray Costanzo said:
No, not quite. View your source and you'll see that you're missing a "
and a space.

Ray at home

Even with this, working, it isn't doing what i want, i want to be able to
submit this to the sendmail.asp page, but this will just submit it to
self.asp

Cheers
Shaiboy
(e-mail address removed)
 
R

Ray Costanzo [MVP]

Shaiboy,

This is a STARTING point. Yes, this will submit back to itself and load the
selected file into a textbox. From there, you can write code that handles
the e-mailing portion if the user submits the form by clicking submit,
pressing enter, or pressing Ctrl+M.

Ray at home
 
S

Shaiboy_UK

Ray Costanzo said:
Shaiboy,

This is a STARTING point. Yes, this will submit back to itself and load
the selected file into a textbox. From there, you can write code that
handles the e-mailing portion if the user submits the form by clicking
submit, pressing enter, or pressing Ctrl+M.

Ray at home

Ray,

Can you email me directly?

Cheers
Shaiboy
(e-mail address removed)
 
R

Ray Costanzo [MVP]

Ray,

Can you email me directly?

Like, if you want to go hang out and drink beers or something, then sure,
let's go! But as far as this topic, usenetiquette mandates the conversation
remains here. Regardless, my e-mail address is discernable from my bogus
address when I post.

Ray at work
 
S

Shaiboy_UK

Ray Costanzo said:
Like, if you want to go hang out and drink beers or something, then sure,
let's go! But as far as this topic, usenetiquette mandates the
conversation
remains here. Regardless, my e-mail address is discernable from my bogus
address when I post.

Ray at work

Don't matter, all sorted now, just iframe, textarea and read commands.

Cheers anyway.
Shaiboy
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top